Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7654525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:16:42+00:00 2026-05-31T12:16:42+00:00

I currently have an excel file (.htm) that I use as a template for

  • 0

I currently have an excel file (.htm) that I use as a template for my invoice reports. Once a user chooses an invoice and hit submit the template is parsed with invoice information and a prompt allows the user to save the file to their computer as an excel file (.xls).

I am now in need of allowing the user to select multiple invoices. Each selected invoice will need to parse to a different sheet.

What I’ve done so far:
I’ve edited the template and created sheet2 from the data copied in sheet1, but I receive an error.

Is there a way to select which worksheet I would like information to parse?
Any advice on perhaps a simpler way to do this?

This prepares my output file

//Prepare the output file
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=\"$filename\"");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
header("Pragma: public");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T12:16:43+00:00Added an answer on May 31, 2026 at 12:16 pm

    You can’t automagically turn HTML markup into an Excel file simply by sending the appropriate headers to the browser. What you’re doing is still sending an HTML file to the user, and MS Excel will be forgiving and open it (but it’s MS Excel that’s parsing/converting the html markup to a format that it can understand and display), not the headers that you send… note that the most recent versions of MS Excel may well issue a warning message when doing so, not the greatest user experience.

    When MS Excel parses/converts an HTML file, it only ever processes the markup into a single worksheet; so unless you change the way you are working to create a real Excel file, you will not be able to create a file that will be read as two or more worksheets by MS Excel.

    A list of libraries capable of creating “real” Excel files can be found in the response to this question. My own preferred choice would be to use PHPExcel (I am biased, I’m the lead developer). However, you would need to rewrite your template as an Excel template rather than HTML… the roadmap for the coming year includes being able to parse HTML to Excel, and that would allow the creation of multiple worksheets from several “pages” of html, but that option isn’t available yet (probably not till about June).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a method that receives a byte array of an excel file.
I have an winforms application that loads in excel files for analysis. Currently, in
I have a user that is currently running my Winforms app on Win7. My
I currently have a CSV file which, when opened in Excel, has a total
I have an object that reads data from an Excel file using, which takes
I have some data that's currently stored in an Excel workbook. It makes sense
Currently we have thousands of Microsoft Word files, Excel files, PDF's, images etc stored
I have a customer who is currently using Excel to do their staff planning.
I have a VSTO Excel workbook that functions correctly in test. I can deploy
I currently have an MS Access application that connects to a PostgreSQL database via

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.