Python Forum

Full Version: linking with excel
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hello everyone
I linked my python code with an excel sheet, I inserted the library and the compiler could read values from the sheet.
but the problem is when I wanted to put these values in a list this error message came out to me:

Error:
AttributeError: 'list' object attribute 'append' is read-only
and the code is:
import xlrd

file_location = "C:/Users/Hp/Documents/sample_grid.xlsx"

workbook = xlrd.open_workbook(file_location)

sheet = workbook.sheet_by_index(0)
ppv=[]

for r in range(sheet.nrows):
   ppv.append = (sheet.cell_value(r ,3))

print(ppv)
-----------------------------------------------------------------------------------------
I tried in different ways but dealing with excel files is really hard and changes from file to file
if anyone can help thanks in advance Smile
ppv.append(sheet.cell_value(r ,3))