So I am doing a side project for my self, trying to learn.
Framework: Flask pandas csv raspberry 4
Goal: to import a csv or xlsx file into a html form and print it out on the html page.
this is what I have so far:
when I import the file, I get the following.
TypeError: 'ImmutableMultiDict' object is not callable
Python Code:
def read_csv(filein):
filein = pd.read_excel('file.xlxs')
print(filein)
@app.route('/import_form', methods=['POST', 'GET'])
def import_form():
if request.method == "POST":
filein = request.files()
print(filein)
#return redirect('/thankyou.html')
else:
return 'something is wrong'
HMTL Code:
<form action="import_form" method="post" class="reveal-content">
<div class="row">
<div class="col-md-7">
<div class="form-group">
<input name="filename" type="file" accept=".csv, .xlsx" class="form-control" id="filename" placeholder="filename" required >
</div>
</div>
<button type="submit" class="btn btn-default btn-lg">Send</button>
</div>
</form>