+ 3

Excel cell color: existing workbook

Hi, I was wondering how you could change the style of a single cell in a workbook. For example: I have a workbook called "test.xlsx" and from sheet 0 I want to color the cell A1 red, can someone help me to write an example for that? For this moment I am looking for a solution using xlrd/xlwt or xlutils. Thank you in advance!

15th Feb 2018, 10:37 PM
Yannick Bollen
Yannick Bollen - avatar
4 Antworten
+ 5
To be honest I've been mostly focused on reading from xls into DataFrames :D, but I think the best library for manipulating the spreadsheets themselves is xlsxwriter. Check out the docs: https://xlsxwriter.readthedocs.io/ and specifically: https://xlsxwriter.readthedocs.io/format.html
17th Feb 2018, 9:50 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 4
No, unfortunately not. But you can easily match it with xlutils or perhaps even openpyxl. Check out the recos here: http://www.python-excel.org
17th Feb 2018, 10:38 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
Thanks Kuba, do you know if this library also supports reading data from the Excel? It would be more convenient to use only one library for reading and writing data. For example you need to write the value from cell A1 to A2..
17th Feb 2018, 9:55 PM
Yannick Bollen
Yannick Bollen - avatar
+ 1
Thanks Kuba, will check that out! :)
17th Feb 2018, 10:40 PM
Yannick Bollen
Yannick Bollen - avatar