Python 在 Apache OpenOffice 中打开和保存 csv 文件

Python to open and save csv file in Apache OpenOffice

我想知道有什么解决办法 1)使用python启动apache open office 2)打开一个csv文件 3)自动填写文本导入 4)然后保存到xls文件中。

import subprocess
subprocess.Popen('C:\Program Files (x86)\OpenOffice 4\program\soffice.exe')

不确定为什么要使用 Python 打开 OpenOffice。但是您可以使用 pandas 库读取 csv 并将其转换为 excel 文件。

import pandas as pd

read_file = pd.read_csv (r'Path where the CSV file is stored\File name.csv')
read_file.to_excel (r'Path to store the Excel file\File name.xlsx', index = None, header=True)