I handle Excel files using the functions row_values and col_values:
import xlrd
workbook = xlrd.open_workbook( filename )
sheet_names = workbook.sheet_names()
for sheet_name in sheet_names:
sheet = workbook.sheet_by_name( sheet_name )
# ...
row_values = sheet.row_values( rownum )
# ...
col_values = sheet.col_values( colnum )
For example, I get col_values as list. What if I meet an empty cell in some column? For example a cell (1,1) is not empty, a cell (1,2) is empty and a cell (1,3) is not empty? How can I detect that the cell (1,2) is empty?
Is this true that I get a list with an empty string as a value of an empty cell (for most well-known programs which generate Excel files)?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…