Make inscrutable csv export string more scrutable
This commit is contained in:
parent
e5acf26d7e
commit
f2246b832d
19
format.py
19
format.py
|
@ -237,12 +237,29 @@ cldr_root = ET.parse(
|
||||||
if args.address_file.suffix == ".csv":
|
if args.address_file.suffix == ".csv":
|
||||||
csv_filename = args.address_file
|
csv_filename = args.address_file
|
||||||
elif args.address_file.suffix == ".ods":
|
elif args.address_file.suffix == ".ods":
|
||||||
|
# https://help.libreoffice.org/latest/en-US/text/shared/guide/csv_params.html
|
||||||
|
export_options = "csv:Text - txt - csv (StarCalc):" + ",".join( # Magic CSV export string
|
||||||
|
[
|
||||||
|
str(ord(",")), # Field Separator
|
||||||
|
str(ord('"')), # Text Delimiter
|
||||||
|
"76", # Character Set - UTF-8 => 76
|
||||||
|
"", # starting line; ignored in export
|
||||||
|
"", # cell format codes; ignored in export
|
||||||
|
"1033", # Language Identifier - en-US => 1033
|
||||||
|
"", # Quoted field as text; default False
|
||||||
|
"", # Detect special numbers; default True
|
||||||
|
"", # Save cell contents as shown; default True
|
||||||
|
"", # Export cell formulas; default false
|
||||||
|
"", # Remove spaces; ignored in export
|
||||||
|
"-1", # Export sheets - all sheets => -1
|
||||||
|
]
|
||||||
|
)
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
[
|
[
|
||||||
"libreoffice",
|
"libreoffice",
|
||||||
"--headless",
|
"--headless",
|
||||||
"--convert-to",
|
"--convert-to",
|
||||||
"csv:Text - txt - csv (StarCalc):44,34,76,1,,0,false,true,true,false,false,-1",
|
export_options,
|
||||||
"--outdir",
|
"--outdir",
|
||||||
str(cache_dir()),
|
str(cache_dir()),
|
||||||
args.address_file,
|
args.address_file,
|
||||||
|
|
Loading…
Reference in a new issue