首页 > 解决方案 > 在 LibreOffice 中以无头模式将 csv 转换为 dbase

问题描述

我可以在 LibreOffice 中以常规模式将带有日期的 csv 文件转换为 dbase。H_beg 日期和 H_end_date 完美地工作。

dbview thexport.dbf
H event id : 210721001
H name     : CCCR WEEK NIGHT 072121
H tot sect : 1
H beg date : 20210721
H end date : 20210721
H rcv date : 
H ent date : 
H aff id   : A6000220
H city     : ROCHESTER
H state    : NY
H zipcode  : 14621
H country  : USA
H sendcros : N
H scholast : N
H secrec01 : 0

但是如果尝试在无头(批处理)模式下自动化操作,日期字段为空白!

bash 脚本: libreoffice --headless --invisible --convert-to dbf thexport.csv

dbview thexport.dbf
H event id : 210721001
H name     : CCCR WEEK NIGHT 072121
H tot sect : 1
H beg date : 
H end date : 
H rcv date : 
H ent date : 
H aff id   : A6000220
H city     : ROCHESTER
H state    : NY
H zipcode  : 14621
H country  : USA
H sendcros : N
H scholast : N
H secrec01 : 0

有任何解决这个问题的方法吗?

标签: libreoffice-calc

解决方案


sudo apt install unoconv

#!/bin/bash 
cd /wherever/your_files_are/
unoconv thexport.csv thexport.dbf
unoconv tsexport.csv tsexport.dbf
unoconv tdexport.csv tdexport.dbf

推荐阅读