Reputation: 5
import xlrd
import goslate
loc = r"C:\path\fruits.xlsx"
gs = goslate.Goslate()
wb = xlrd.open_workbook(loc)
sheet = wb.sheet_by_index(0)
for i in range(sheet.nrows):
print(gs.translate(sheet.cell_value(i, 0), 'de'))
print(sheet.cell_value(i, 1)
I am receiving the below error
return self._cell_values[rowx][colx]
IndexError: list index out of range
Please someone help me to write my output/result in the same excel in Column B
Upvotes: -2
Views: 53
Reputation: 2379
for i in range(sheet.nrows - 1)
Python indicies begin from 0, so the last row will be sheet.nrows - 1
make sure to also add the closing parenthesis to the last print statement
print(sheet.cell_value(i, 1))
Upvotes: 0