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 8569381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:19:17+00:00 2026-06-11T18:19:17+00:00

Actually I am using xlrd module 0.8 version, but I don’t know how to

  • 0

Actually I am using xlrd module 0.8 version, but I don’t know how to read cell properties like background color, font, and whether cell is locked.

I tried to use

import xlrd
wb = xlrd.open_workbook(...)
sh = wb.sheet_by_index(...)
sh.sh._cell_xf_indexes(2, 2)

It raises an error saying formatting information needs to be set while reading wb, but if I had that parameter then it shows it is still not implemented.

Is there another module or how can this module itself be made to read cell properties?

  • 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-06-11T18:19:18+00:00Added an answer on June 11, 2026 at 6:19 pm

    The following works for me, using xlrd version 0.7.6:

    from xlrd import open_workbook
    
    wb = open_workbook('tmp.xls', formatting_info=True)
    sheet = wb.sheet_by_name("1")
    cell = sheet.cell(6, 0)
    print "cell.xf_index is", cell.xf_index
    fmt = wb.xf_list[cell.xf_index]
    print "type(fmt) is", type(fmt)
    print
    print "fmt.dump():"
    fmt.dump()
    

    fmt is an instance of the XF class; see https://secure.simplistix.co.uk/svn/xlrd/trunk/xlrd/doc/xlrd.html#formatting.XF-class

    The dump() method prints all the information about the format. Here’s the output of the above code:

    cell.xf_index is 497
    type(fmt) is <class 'xlrd.formatting.XF'>
    
    fmt.dump():
    _alignment_flag: 1
    _background_flag: 1
    _border_flag: 1
    _font_flag: 1
    _format_flag: 0
    _protection_flag: 0
    alignment (XFAlignment object):
        hor_align: 1
        indent_level: 0
        rotation: 0
        shrink_to_fit: 0
        text_direction: 0
        text_wrapped: 0
        vert_align: 2
    background (XFBackground object):
        background_colour_index: 64
        fill_pattern: 1
        pattern_colour_index: 17
    border (XFBorder object):
        bottom_colour_index: 0
        bottom_line_style: 0
        diag_colour_index: 0
        diag_down: 0
        diag_line_style: 0
        diag_up: 0
        left_colour_index: 0
        left_line_style: 0
        right_colour_index: 0
        right_line_style: 0
        top_colour_index: 56
        top_line_style: 1
    font_index: 72
    format_key: 0
    is_style: 0
    lotus_123_prefix: 0
    parent_style_index: 0
    protection (XFProtection object):
        cell_locked: 1
        formula_hidden: 0
    xf_index: 497
    

    Some of those values are indices into lists on the workbook wb. For example, fmt.font_index is 72, and wb.font_list[72] is an instance of the Font class (https://secure.simplistix.co.uk/svn/xlrd/trunk/xlrd/doc/xlrd.html#formatting.Font-class).

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

Sidebar

Related Questions

I am using ExtJS version 3.0.0 and I really don't know why every time
I'm new to Visual C# Studio (actually using the Express edition, but another developer
How do you know if the browser is actually using the cached swf RSL/library
I'm creating a Silverlight 3.0 MVVM application using Silverlight.FX but my View is actually
I'm sure this is not a very pythonic situation. But I'm not actually using
I am actually using this calendar source code, but I did encountered a problem
I'm actually using ASP.Net MVC, but I think this applicable to ASP.Net as well.
I am actually using PHP but such crawling can be done by any programming
I am actually using Robotium testing framework for Android, but I believe it's based
I'm new to BigQuery (and to actually using Google API's whatsoever). Trying to read

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.