Importing excel sheet & trying to add all cell values in a single column, but keep getting ValueError. For reference, the excel sheet starts with a '', then the column name, which is 'Revenue', then the numbers. I'm assuming this error is coming from me trying to add the blank cell - Any ideas how to fix this? The blank cell is a result from a merged title cell, so I cant add a number to it ?
int('')抛出该错误。
我的建议是检查该单元格值是否包含空字符串:
s = sheet.cell_value(row,5) is_positive = int(s) if s else 0 if is_positive>=0: #add logic