flask_excel 示例源代码

安装:pip install Flask-Excel​​​​​
pip install pyexcel-xls
pip install pyexcel-xlsx
from flask import Flask, request, jsonify
from flask.ext import excel

app=Flask(__name__)

@app.route("/upload", methods=['GET', 'POST'])
def upload_file():
    if request.method == 'POST':
        return jsonify({"result": request.get_array(field_name='file')})
    return '''
    
    Upload an excel file
    

Excel file upload (csv, tsv, csvz, tsvz only)

''' @app.route("/export", methods=['GET']) def export_records(): return excel.make_response_from_array([[1,2], [3, 4]], "csv", file_name="export_data") if __name__ == "__main__": app.run()

 

你可能感兴趣的:(Flask,Office处理)