2

I have an issue with openpyxl library.

Problem:

When I used xlwt, opened an .xls file, and wrote some cells in there, the styles of cells I didn't touch remained the same. But now I have to work with xlsx documents, so I chose openpyxl for this. But after saving it with a .save function, it completely strips the style of a document, even the cells I didn't touch at all.

Any suggestions on how I can preserve the style?

ballade4op52
  • 2,142
  • 5
  • 27
  • 42
Viktor
  • 580
  • 2
  • 14
  • 29

2 Answers2

3

I'm having this exact problem, apparently there is no good way to preserve the styles in openpyxl, see Use openpyxl to edit a Excel2007 file (.xlsx) without changing its own styles?

Community
  • 1
  • 1
A Alstone
  • 1,087
  • 2
  • 10
  • 12
1

I don't think openpyxl solved this issue yet. You can try pywin32 to directly interact with windows API with Excel, you can do everything there you want.

Haohan Li
  • 51
  • 3