linux - 在邮寄过程中通过 shell 脚本将 csv 转换为 Excel

标签 linux bash shell

我有以下代码

   awk test1 > out.xsl
 mail -a out.xsl "Test Subject" abc@gmail.com < /dev/null

So I have a file in csv format and i need to convert it into excel when the mail is being sent. I do receive the mail but it gets corrupted when I try to open it. Test1 is a CSV file and Iam converting it in excel file named out.xsl. Iam sending the excel file in mail but Iam not able to open it or view anything inside it Please help

最佳答案

使用unoconv:

unoconv -i FilterOptions=9,,76 -f xls  tables.csv

这里 9 是用作字段分隔符的制表符,76 是代码页 (UTF-8)。

(unoconv 不支持 xlsx,仅支持 xls)。

或者使用xlsxwriter编写一个简单的Python脚本:示例是here .

关于linux - 在邮寄过程中通过 shell 脚本将 csv 转换为 Excel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43648932/

相关文章:

bash - 排序变量

linux - Shell脚本,将每2个文件移动到每个目录

linux - 生成包含给定范围内任意大小的一组文件的内容的文件

linux - Linux 中的调试命令路由

c - mount() after clone() with CLONE_NEWNS set effects parent

bash - 每n行插入多个空格

MySQL 通过命令行变量设置密码

linux - 移动与其包含的文件同名的文件

linux - 根据存在的命令终止 Linux 进程

Linux 历史详细信息