I am using xlrd in appengine. I use flask
I cant read the input file and it keeps on showing the same error message
the code is
def read_rows(inputfile):
rows = []
wb = xlrd.open_workbook(inputfile)
sh = wb.sheet_by_index(0)
for rownum in range(sh.nrows):
rows.append(sh.row_values(rownum))
return rows
@app.route('/process_input/',methods=['POST','GET'])
def process_input():
inputfile = request.files['file']
rows=read_rows(request.files['file'])
payload = json.dumps(dict(rows=rows))
return payload
I realize that this might be caused by not uploading and saving it as a file. Any workaround on this? This would help many others as well. Any help is appreciated, thx
Update: Found a solution that I posted below. For those confused with using xlrd can refer to the open source project repo I posted. The key is passing the content of the file instead of the filename