Python Forum
can openpyxl read font colors
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
can openpyxl read font colors
#1
I have a task to remove duplicate entries from a column in a spreadsheet. I can loop through the spreadsheet using

        for i in range(3, self.workbook_sheet.max_row+1):
            row = [cell.value for cell in self.workbook_sheet[i][5:6]]
This cell has multiple text entries in red and green text. I need to determine which text is red and which is green and separate the values.

for example, the following text would exist in one cell. I need to separate the 4 values find out what color they are and record the value.

1234[g]
4567[r]
0192[g]
1234[r]

Is there a way to do this in openpyxl? I have not been able to find a way to do it anywhere.
Reply
#2
I investigated and think your request is about rich text. Rich text can be written to a excel file with openpyxl version 3.1.2,
but can't be read. I did not try but this might be a solution:
openpyxl patch
Reply
#3
This is the link to the problem offering the patch to retrieve the Textdata:

problem description
Reply
#4
I had the same question recently, it was described in detail here, maybe it will help you.
buran write May-09-2023, 11:36 AM:
Link removed, it does not address OP question, but it looks very much like clickbite
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Count image's colors very fast flash77 18 1,586 Mar-05-2024, 06:12 PM
Last Post: deanhystad
  ANSI not working for change of text colors BliepMonster 10 3,418 Nov-10-2022, 09:28 AM
Last Post: BliepMonster
  How to do bar graph with positive and negative values different colors? Mark17 1 5,169 Jun-10-2022, 07:38 PM
Last Post: Mark17
  Load external font and does not show font in the window ATARI_LIVE 16 8,190 Feb-05-2021, 10:36 PM
Last Post: EthanPayne
  Plot Back Ground Colors JoeDainton123 0 2,197 Aug-19-2020, 11:09 PM
Last Post: JoeDainton123
  How to fill between the same area with two different colors Staph 0 1,494 Jul-08-2020, 07:01 PM
Last Post: Staph
  Using OpenPyXL How To Read Entire Column Into Dictionary jo15765 1 2,690 Jun-08-2020, 04:10 AM
Last Post: buran
  How do I map a list of values to specified colors? larkypython 4 2,575 Nov-05-2019, 09:22 AM
Last Post: larkypython
  after using openpyxl to add colors to script, black shows up white online in excel Soundtechscott 1 3,697 Jun-08-2019, 10:33 PM
Last Post: Soundtechscott
  in openpyxl, how to set the font to 'centred'? Pedroski55 3 16,466 Sep-17-2018, 01:18 AM
Last Post: pcsailor

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020