/upload url을 통해서 엑셀 파일을 업로드 한 다음 별도의 파일 저장없이 바로 html 화면에 보여줌
from flask import Flask, render_template, request, Response
from werkzeug import secure_filename
import pandas as pd
app = Flask(__name__)
@app.route("/upload", methods=['GET', 'POST'])
def upload_file():
if request.method == 'POST':
print(request.files['file'])
f = request.files['file']
data_xls = pd.read_excel(f)
return data_xls.to_html()
return '''
<!doctype html>
<title>Upload an excel file</title>
<h1>Excel file upload</h1>
<form action="" method=post enctype=multipart/form-data>
<p><input type=file name=file><input type=submit value=Upload>
</form>
'''