Last active
February 1, 2022 22:24
-
-
Save jhanschoo/bcd6d08d1e0f4b5d52735287f39ca924 to your computer and use it in GitHub Desktop.
Uses LibreOffice to convert a file to csv format, preserving Unicode characters in UTF-8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# localc2csv.sh [--outdir OUTPIT_DIR] FILE [FILE...] | |
# Uses LibreOffice to convert a file to csv format, preserving | |
# Unicode characters in UTF-8 | |
# Assumes LibreOffice is installed to /Applications in MacOS. | |
# for documentation on the arguments, c.f. | |
# https://ask.libreoffice.org/en/question/2641/convert-to-command-line-parameter/ | |
# https://help.libreoffice.org/Common/Starting_the_Software_With_Parameters | |
# https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options | |
## Unfortunately, LibreOffice documentation does not adequately cover | |
## convert-to parameters; know-how is scattered across forum threads. | |
/Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to \ | |
"csv:Text - txt - csv (StarCalc):44,34,76,1,1/1:" "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment