Need help - How to identify the cell display format?

Ezhilarasan Chandrasekar aezhil90 at gmail.com
Tue Jan 5 01:39:37 EST 2016


I tried the following,

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

But there is some problem with the load_workbook package. I get a error in
reading .xls file.

Could anyone please help me out from this?

Its really Urgent for me, Is there any other alternative way to read excel
cell display format?

--
Warm regards,
Ezhilarasan

On Tue, Dec 15, 2015 at 7:34 PM, Larry Martell <larry.martell at gmail.com>
wrote:

> On Tue, Dec 15, 2015 at 2:29 AM, Ezhilarasan Chandrasekar
> <aezhil90 at 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
> --
> https://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list