• Creator
  • #3937425

    How to Use an HTML Excel File Input

    by bgilley227 ·

    My research team is building a website that requires the user to input an Excel file (.xlsx) with 6 different sheets. Each sheet has a different quantity of data. I understand that to create a file input button, you use the following format:

    However, I’m not sure how to process the data inside of the Excel file the user inputs. We are using Python’s flask module as the web framework, so ideally, the contents of each sheet would be loaded into dictionaries on the flask file. I am not sure how to extract the data from each sheet of the file they input. Any help is appreciated. Thanks!

You are posting a reply to: How to Use an HTML Excel File Input

The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our Community FAQs for details. All submitted content is subject to our Terms of Use.

All Answers

  • Author
    • #3939987
      Avatar photo

      Re: spreadsheet

      by kees_b ·

      In reply to How to Use an HTML Excel File Input

      That’s a file upload. Just save the file and use any program on the server (like MS Excel or LibreOffice Calc) to read and process it. That might need some macro’s.

      • #3939984

        Reply to Kees_B

        by bgilley227 ·

        In reply to Re: spreadsheet

        This is for a website with no system operator or anything like that. When the user inputs the file, it has to be automatically processed and put into Python dictionaries to be sent to the back end for calculations. I’m just not sure how to go from the input button to all of the contents of the file being put into Python dictionaries. Is there a way to work with the HTML input directly, or could the file automatically be saved to the directory, and then another function could be written to work with that file? Thanks

        • #3939982
          Avatar photo

          Re: save

          by kees_b ·

          In reply to Reply to Kees_B

          Yes, it’s easy to save the file (the sites I read talk about a save-method, but I can’t give the details) in a folder. I wouldn’t call that processing.

          And once it’s in a folder the OS can do with it what you want. Use [i]at[/i] in Linux or the task scheduler in Windows.

          But why not save it directly in a folder the backend can read?
          Or, even easier maybe, give each user an ftp-script that copies his spreadsheet to some folder near the backend. Why do you need an intermediate site?

        • #3939981


          by bgilley227 ·

          In reply to Re: save

          It would certainly work if the file was saved directly in a folder that the backend can read. I’m just not sure how to take the HTML file input and save it to a directory on the server. Any tips with this? I could be searching for the wrong things, but I can’t find much info on this, and what I do find involves a lot of JavaScript (which seems unnecessary for such a common task).

        • #3939972
          Avatar photo

          Re: save file

          by kees_b ·

          In reply to Re

 gives example code to upload and save a file in Flask.

          Worth a try, I’d say.

    • #3939980
      Avatar photo

      Your developer could use Pandas (that Python library.)

      by rproffitt ·

      In reply to How to Use an HTML Excel File Input

      Your posts so far tell me about your use of Flask but why HTML given the story? Why not Pandas to get inside the Excel sheets?

      Tutorial at

      But let’s back up to the beginning. I feel you haven’t completed your System Design. This is something I see missing in many CompSci paths today. We used to call it Systems Analysis but for here you have the Flask, the Excel file and now need to complete your System Design.

      1. The web page that the user sees and uploads the file.
      2. The backend that places the file where you feel it needs to be.
      3. The other backend (Python + Pandas) to pull out the data to the format that is needed for the next step.
      Continue with more steps.

      If something is too hard, break it down into more steps. Repeat the break down until it’s something you or your programmers can handle.

      • #3939978

        Reply to rproffitt

        by bgilley227 ·

        In reply to Your developer could use Pandas (that Python library.)

        Thanks for the response. My team has already created a function that can read the Excel file that the user inputs on the HTML page. The Excel file will always be in the same format, so we have used Pandas to read the file. Right now, this function references a template Excel file that is in the same directory. In practice, the Pandas function won’t read the template file. It will read the file that the user inputs. Our problem is that we do not know how to save the Excel file that the user inputs to the same directory as the Pandas function (or any directory for that matter). We do not understand how the Excel file that is input using a submit button in HTML (with type=”file”) can be saved to a specific directory. Thanks for the help

Viewing 1 reply thread