I am trying to read all values within the first sheet of an excel file via xlrd, but I need it to start reading values from row 3 of the excel sheet, until the end of values in the column
Current version reads all information within the columns including the headers, this is not desired
code:
for col in range(sheet.nrows):
names = sheet.cell(col,0)
nums = sheet.cell(col,1)
if names.value != xlrd.empty_cell.value:
if nums.value != xlrd.empty_cell.value:
f.write('\t\t\t\t\t\t\t\t\t'+ '<li><strong>' + names.value + '</strong> '+ repr(nums.value)+'</li>' + "\n")
Change your index in the code..... for col in range(2,sheet.nrows):
should give the desired behaviour.
On a sidenote, you should really rename your variables, you're using col as a variable for the number of rows in a sheet (which causes all kinds of confusion).
EDIT to point out that XLREAD is 0 indexed.