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
  module 'openpyxl.workbook' has no attribute 'active' lsaavedra21 5 1,702 Oct-30-2024, 06:26 PM
Last Post: lsaavedra21
  using last 2 characters of a file name to identify it CAD79 5 1,786 Jul-12-2024, 02:09 PM
Last Post: deanhystad
  Need help to identify CNA for automation qatester 0 548 May-31-2024, 09:24 AM
Last Post: qatester
  identify not white pixels in bmp flash77 17 7,763 Nov-10-2023, 09:21 PM
Last Post: flash77
  How to copy work sheet data one workbook to other? sayyedkamran 2 1,535 Nov-03-2023, 09:10 AM
Last Post: Larz60+
  Python and pandas: Aggregate lines form Excel sheet Glyxbringer 12 5,166 Oct-31-2023, 10:21 AM
Last Post: Pedroski55
  Turtle Star Fill Color Yellow-White Interchanging Color Effect codelab 9 3,407 Oct-25-2023, 09:09 AM
Last Post: codelab
  xlwings error when reading a workbook Mishal0488 1 2,340 Aug-01-2023, 02:05 AM
Last Post: deanhystad
  how to read txt file, and write into excel with multiply sheet jacklee26 14 17,062 Jan-21-2023, 06:57 AM
Last Post: jacklee26
  Help in opening and editing an excel workbook from a web-browser test 4 2,540 Aug-10-2022, 02:31 PM
Last Post: test

Forum Jump:

User Panel Messages

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