Python Forum
Need to identify sheet color in excel workbook
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need to identify sheet color in excel workbook
#1
Hi all,

I have a given excel workbook that has multiple sheets. Some of these sheets have a colored background to them. Unfortunately, I am having trouble attaching a screenshot of this but I basically need to identify sheets that have a blue background.

I know that openpyxl and xlrd have the ability to load workbooks, get the sheet names and then loop through them. Does either of these modules have the ability to grab the sheet color or is there another library that can handle my intended scenario?

Below is some code I have been playing around with ..

# from openpyxl import load_workbook

# workbook = load_workbook(filename='TestRateFile.xlsx', read_only=True)
# sheets = workbook.sheetnames

# for s in sheets:
    # print(s)

import xlrd
loc = ('InXLS.xls')

wb = xlrd.open_workbook(loc, formatting_info=True)
sheets = wb.sheet_names()

for index, sh in enumerate(sheets):
    print(sh)

Below is the snippet I took of the workbook sheets

https://imgur.com/a/8Kdha8P
Reply
#2
only a guess, but named_styes? https://openpyxl.readthedocs.io/en/lates...med_styles
Reply
#3
Unfortunately, the named_styles approach did not work :(
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  identify not white pixels in bmp flash77 17 2,269 Nov-10-2023, 09:21 PM
Last Post: flash77
  How to copy work sheet data one workbook to other? sayyedkamran 2 645 Nov-03-2023, 09:10 AM
Last Post: Larz60+
  Python and pandas: Aggregate lines form Excel sheet Glyxbringer 12 1,695 Oct-31-2023, 10:21 AM
Last Post: Pedroski55
  Turtle Star Fill Color Yellow-White Interchanging Color Effect codelab 9 902 Oct-25-2023, 09:09 AM
Last Post: codelab
  xlwings error when reading a workbook Mishal0488 1 1,036 Aug-01-2023, 02:05 AM
Last Post: deanhystad
  how to read txt file, and write into excel with multiply sheet jacklee26 14 9,513 Jan-21-2023, 06:57 AM
Last Post: jacklee26
  Help in opening and editing an excel workbook from a web-browser test 4 1,357 Aug-10-2022, 02:31 PM
Last Post: test
  Reading Excel file and use a wildcard in file name and sheet name randolphoralph 6 6,857 Jan-13-2022, 10:20 PM
Last Post: randolphoralph
  guys please help me , pycharm is not able to identify my xlsx file CrazyGreenYT7 1 1,971 Jun-13-2021, 02:22 PM
Last Post: Larz60+
  Python script for excel sheet Nabil 4 3,224 Jun-01-2021, 05:09 AM
Last Post: Pedroski55

Forum Jump:

User Panel Messages

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