使用 soffice 命令行将 xls 转换为分号分隔的 csv

Converting xls to semicolon delimited csv with soffice commandline

我正在尝试使用 soffice 将目录中的 xls 文件转换为 csv 格式。

    soffice --headless --convert-to csv *

它给出了逗号分隔的版本(很明显)。现在我想获取以分号分隔的 csv。

我想用 vim 命令用分号替换逗号。

    :%s/,/;/g

但这是不正确的,因为它取代了原始内容中有意保留的逗号。从 xls 转换为 csv 时必须分隔。

如何使用 soffice 命令行获取分号分隔的 csv?

终于有了答案。添加 output_filter_options 非常有效。

    --convert-to output_file_extension[:output_filter_name[:output_filter_options]] [--outdir output_dir] files

wiki link 有帮助。这是我所做的,

    soffice --headless --convert-to csv:"Text - txt - csv (StarCalc)":59,34,0,1,1 *.xls

NOTE: It works with libre office 4.3 or higher version.