简体   繁体   中英

openpyxl xlsx file cell value = none

I want to read an xlsx file using openpyxl. Here is the typical code i use:

import openpyxl

wb = openpyxl.load_workbook("example.xlsx")
sh = wb.get_sheet_by_name(name="Sheet3") or wb.get_sheet_by_name(name="Section3")
for rownum in range(1, sh.get_highest_row()):
    print str(sh.cell(row=rownum, column=1).value)

In this example i'm able to find values from the 1st column. The problem is i have data in the second column and others column but in output i got None....

Any help will be appreciate.

It works with the library xlrd. The excel file is generated with a java library.IT look's problematic with this way of creation. Open it with excell 2013 and save it as a new xlsx file works also better.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM