简体   繁体   English

openpyxl xlsx文件单元格值=无

[英]openpyxl xlsx file cell value = none

I want to read an xlsx file using openpyxl. 我想使用openpyxl读取xlsx文件。 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. 在这个例子中,我能够从第1列中找到值。 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. 它适用于库xlrd。 The excel file is generated with a java library.IT look's problematic with this way of creation. excel文件是用java库生成的。使用这种创建方式看起来有问题。 Open it with excell 2013 and save it as a new xlsx file works also better. 使用excell 2013打开它并保存为新的xlsx文件也可以更好地工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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