Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #100456

Re: Need help - How to identify the cell display format?

From Larry Martell <larry.martell@gmail.com>
Newsgroups comp.lang.python
Subject Re: Need help - How to identify the cell display format?
Date 2015-12-15 09:04 -0500
Message-ID <mailman.19.1450188306.22044.python-list@python.org> (permalink)
References <CAAM3Zgb4Rmzk2gk6rQ8hmmKJPOHpxEgP+O8tz1jQfWP5kxhnwg@mail.gmail.com>

Show all headers | View raw


On Tue, Dec 15, 2015 at 2:29 AM, Ezhilarasan Chandrasekar
<aezhil90@gmail.com> wrote:
> Hi folks,
>
> I just want to find the cell display format in Excel. I have a Expected
> excel file and Actual Excel file.
>
> I have some knowledge about, how to check the cell value, cell font,
> alignment. But I also want to know about what type of cell format is being
> used.
>
> For example: If the cell value has "*04:05:00 AM*", but it displays as "
> *04:05:00*"(AM notation not needed) which is of format "*hh:mm:ss*"
>
> I want to identify the cell format *(hh:mm:ss)* from Expected Excel file
> and compare with the Actual Excel file

You can do this with openpyxl, for example:

from openpyxl.reader.excel import load_workbook

book = load_workbook(filename='transactions.xlsx')
sheet = book.get_sheet_by_name('transactions')
print sheet.cell("A12").style.number_format
print sheet.cell("A13").style.number_format

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Need help - How to identify the cell display format? Larry Martell <larry.martell@gmail.com> - 2015-12-15 09:04 -0500

csiph-web