Reputation: 83
I am writing software that manipulates Excel sheets. So far, I've been using xlrd and xlwt to do so, and everything works pretty well.
However, I am now willing to add charts in my documents, and this function is not supported by xlwt. I have found that xlsxwriter does, but this adds other complications to my code: xlsxwriter only has xlsxwriter.close()
, which saves AND closes the document.
Does anyone know if there's any workaround for this? Whenever I use xlsxwriter.close()
, my workbook object containing the document I'm writing isn't usable anymore.
Upvotes: 4
Views: 2208
Reputation: 14529
Fundamentally, there is no reason you need to read twice and save twice. For your current (no charts) process, you can just read the data you need using xlrd; then do all your processing; and write once with xlwt.
Following this workflow, it is a relatively simple matter to replace xlwt with XlsxWriter.
Upvotes: 4