Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6791075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:48:08+00:00 2026-05-26T17:48:08+00:00

I am writing a python script to read data from an excel sheet using

  • 0

I am writing a python script to read data from an excel sheet using xlrd. Few of the cells of the the work sheet are highlighted with different color and I want to identify the color code of the cell. Is there any way to do that ? An example would be really appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:48:09+00:00Added an answer on May 26, 2026 at 5:48 pm

    Here is one way to handle this:

    import xlrd
    book = xlrd.open_workbook("sample.xls", formatting_info=True)
    sheets = book.sheet_names()
    print "sheets are:", sheets
    for index, sh in enumerate(sheets):
        sheet = book.sheet_by_index(index)
        print "Sheet:", sheet.name
        rows, cols = sheet.nrows, sheet.ncols
        print "Number of rows: %s   Number of cols: %s" % (rows, cols)
        for row in range(rows):
            for col in range(cols):
                print "row, col is:", row+1, col+1,
                thecell = sheet.cell(row, col)      
                # could get 'dump', 'value', 'xf_index'
                print thecell.value,
                xfx = sheet.cell_xf_index(row, col)
                xf = book.xf_list[xfx]
                bgx = xf.background.pattern_colour_index
                print bgx
    

    More info on the Python-Excel Google Group.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was writing a simple python script to read from and reconstruct data from
I'm writing a python script to extract data out of our 2GB Apache access
I amm writing a little python script that will grab information from VMs of
I'm writing a python script to read through a list of domains, find out
I am writing a python script on Linux for twitter post using API, Is
I'm writing a Python script to process emails returned from Procmail . As suggested
I'm writing a python script that uses subprocess.Popen to execute two programs (from compiled
I'm writing a python script to replace strings from a each text file in
When writing a Python script that can be executed in different operating system environments
I'm writing a script in Python that saves attachments from Gmail, only from unseen

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.