Python,OpenOffice:以编程方式处理电子表格 [英] Python, OpenOffice: Programmatically Manipulating spreadsheets

查看:154
本文介绍了Python,OpenOffice:以编程方式处理电子表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于电子表格的自动报告,每天需要创建,其中包含一些图表,汇总功能(例如SUM和AVERAGE)和格式化的单元格(日期,百分比等).

I have an spreadsheet-based automated report that needs to be created daily, with some charts, aggregating functions (e.g. SUM and AVERAGE) and formatted cells (Dates, percentage, etc.).

我试图将这些结果直接写入Excel文件,但Python的 xlwt

I have tried to write these results directly to an Excel file, but Python's xlwt and xlrd don'y support charts and functions.

此外,尝试打开现有的格式化Excel文件并更改某些单元格的值最终导致擦除了现有文件中的所有图表和功能.

Moreover, trying to open an existing, formatted Excel file and changing some cell's values ended up erasing all charts and functions in the existing file.

是否可以将图表和功能写入OpenOffice电子表格,或者至少在不删除数据的情况下更改现有电子表格中的单元格?如果有Python方式可以做到,那么我可以轻松地将OO文件转换为Excel文件并交付.

Is there a way to write charts and functions to an OpenOffice spreadsheet, or at least change cells in an existing spreadsheet without erasing data? If there is a Pythonic way to do it, I can easily convert the OO file into an Excel file and deliver it.

推荐答案

您可以使用 PyUNO ,一个使用UNO API的Python库.

You can use PyUNO, a Python library to use UNO API.

此处是在其中进行某些操作的Python示例Calc文档.

Here is a Python example to do some manipulations in a Calc document.

这篇关于Python,OpenOffice:以编程方式处理电子表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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