使用Soffice命令行将xls转换为以分号分隔的csv [英] Converting xls to semicolon delimited csv with soffice commandline

查看:87
本文介绍了使用Soffice命令行将xls转换为以分号分隔的csv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to convert xls files in a directory to csv format using soffice.

    soffice --headless --convert-to csv *

它给出了逗号分隔的版本(显然).现在,我想获取以分号分隔的csv.

It is giving comma separated version(obviously). Now I want to get semi-colon delimited csv.

我想到了使用vim命令用分号替换逗号.

I thought of replacing commas with semi-colons using vim command.

    :%s/,/;/g

但这是不正确的,因为它替换了故意保留在原始内容中的逗号.从xls转换为csv时必须定界.

But it's not correct, as it replaces commas which are kept intentionally in original content. It has to delimit while converting from xls to csv.

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

How to get semi-colon delimited csv with soffice command line?

推荐答案

最后,我得到了答案.添加output_filter_options很有魅力.

Finally, I got an answer. Adding output_filter_options worked like a charm.

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

Wiki链接提供了帮助.这就是我所做的,

This wiki link helped. Here is what I did,

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

注意:它适用于libre office 4.3或更高版本.

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

这篇关于使用Soffice命令行将xls转换为以分号分隔的csv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆