bash 仅在 Linux 上通过命令行将 xlsx 转换为文本 CSV
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15746295/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Convert xlsx to text CSV via command line only on Linux
提问by Numpty
Simple question:
简单的问题:
Is it currently possible to invoke LibreOffice from a command line to open a *.xlsx and convert/save it as a *.csv?
目前是否可以从命令行调用 LibreOffice 来打开 *.xlsx 并将其转换/保存为 *.csv?
Alternatively, if this is not possible what is the current best method for doing this via command line (needs to be invokable via script)?
或者,如果这是不可能的,那么当前通过命令行执行此操作的最佳方法是什么(需要通过脚本调用)?
Thanks,
谢谢,
回答by n3rV3
Here is the command:
这是命令:
localc --headless --convert-to csv:"Text - txt - csv (StarCalc)" *.xlsx
The above will save all converted files in current directory(directory from where you'll run the command). All converted files will have their filename extensions changed to csv.
以上将把所有转换后的文件保存在当前目录(您将运行命令的目录)中。所有转换后的文件的文件扩展名都将更改为 csv。
Alternative, method is the use of unoconvwhich i've not used.
另一种方法是使用unoconv我没有使用过的方法。

