Ask Your Question
0

creating a Calc sheet from python

asked 2020-07-31 08:52:42 +0200

papimla gravatar image

updated 2020-07-31 10:17:23 +0200

Hi,

I'm looking for a well maintained way to create a Calc sheet from a python script, that is:

  • open the ODS file
  • add a new sheet with data in it
  • save the ODS file

I found a few modules such as odfpy or ezodf (no longer maintained, last commit is 2017) but it is unclear which one is best suited to this purpose. There also is a 2015 question that is almost similar to mine but it is ancient by Python standards.

Although I've been able to create a Calc sheet using the ezodf example it does not sound like a solution. If the module faces a critical bug next week for any reason, there will be no fix because it is not maintained.

Thanks in advance for your help !

edit retag flag offensive close merge delete

Comments

1

Instead of a third-party library, have you considered Python-UNO? LibreOffice has an API, and it comes with Python support. Otherwise, if you do not plan to use LibreOffice in your script, then your question may be off-topic for this site. Personally, I do not use such third-party libraries, and I'm not sure others on this site do either.

Jim K gravatar imageJim K ( 2020-08-01 00:06:53 +0200 )edit

The only downside of UNO is the need to run a libreoffice headless server. But that's ok :-) Thanks!

papimla gravatar imagepapimla ( 2020-08-01 12:45:24 +0200 )edit

1 Answer

Sort by » oldest newest most voted
2

answered 2020-07-31 16:25:26 +0200

mauricio gravatar image

Hi...

For open look: https://wiki.documentfoundation.org/M...

For add new sheet: https://wiki.documentfoundation.org/M...

For save ODS

doc.store()

Best regards

edit flag offensive delete link more

Comments

UNO is a little bit complex to use but stable. Excellent find!

papimla gravatar imagepapimla ( 2020-08-01 12:44:43 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-07-31 08:52:42 +0200

Seen: 66 times

Last updated: Jul 31