Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100456 > unrolled thread
| Started by | Larry Martell <larry.martell@gmail.com> |
|---|---|
| First post | 2015-12-15 09:04 -0500 |
| Last post | 2015-12-15 09:04 -0500 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Need help - How to identify the cell display format? Larry Martell <larry.martell@gmail.com> - 2015-12-15 09:04 -0500
| From | Larry Martell <larry.martell@gmail.com> |
|---|---|
| Date | 2015-12-15 09:04 -0500 |
| Subject | Re: Need help - How to identify the cell display format? |
| Message-ID | <mailman.19.1450188306.22044.python-list@python.org> |
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 top | Article view | comp.lang.python
csiph-web