how to process an upload file in Flask?
<p>I have a simple Flask app and I would like for it to process an uploaded excel file and display it's data in the webpage.  So far I got a page to upload the excel file.</p>

<p>main.py</p>

<pre><code>from flask import Flask, render_template, send_file, request
from flask_uploads import UploadSet, configure_uploads, DOCUMENTS, IMAGES

app = Flask(__name__)

#the name 'datafiles' must match in app.config to DATAFILES
docs = UploadSet('datafiles', DOCUMENTS)
app.config['UPLOADED_DATAFILES_DEST'] = 'static/uploads'
configure_uploads(app, docs)

@app.route("/", methods=['GET'])
def index():
  # return send_file("templates/index.html")
  return render_template('index.html')

@app.route("/upload", methods = ['GET', 'POST'])
def upload():
  #user_file is the name value in input element
  if request.method == 'POST' and 'user_file' in request.files:
    filename = docs.save(request.files['user_file'])
    return filename
  return render_template('upload.html')

@app.route("/mergedata", methods=['GET'])
def merge_data():
   return send_file("templates/mergeDataPage.html")

if __name__ == "__main__":
  app.run(host='0.0.0.0', debug=True)
</code></pre>

<p>upload.html</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;upload&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;form method="POST" enctype=multipart/form-data action ="{{url_for('upload')}}"&gt;
      &lt;input type="file" name="user_file"&gt;
      &lt;input type="submit"&gt;
    &lt;/form&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>Once the file is uploaded, I would like to process this excel data by using another python script - This script will take the excel file, remove special characters and converted to a csv file/output.  I would like to display the csv output in the webpage.</p>

<p>The idea is for users to upload the file, press a button to clean the data and have the results printed in an output box.  How do I go about in building something like this scenario?  </p>

<p>I'm pretty new to Flask, but so far has been pretty exciting to learn this cool web framework. Your help will be appreciated, thanks!</p>