Python Forum

Full Version: append in excel
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
greetings everyone
i am currently trying to insert the data from excel into the array but the output of it only an empty array

Headers_ = []
Values_ = []
for i in range(sheet.nrows):
    if sheet.row_values(i,0) == 'mine':
        Row_list_ =[]
        Row_Val_ =[]
        for j in range(sheet.ncols):
            Row_list_.append(sheet.row_values(i,j))
            Row_Val_.append(sheet.row_values((i+1),j))
        Headers_.append(Row_list_)
        Values_.append(Row_Val_)
print(Values_)
output
[]
maybe because none of sheet.row_values(i,0) is equal to 'mine'?
if that condition is not true nothing is appended to Values_

btw: please have a look into PEP 8 - Style Guide for Python code
What do you think this _ at the end of your variables does?
Nothing but it makes our eyes scream wtf.