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 5975513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:05:44+00:00 2026-05-22T21:05:44+00:00

This is right now I am using. $mimeType = ‘application/vnd.openxmlformats-officedocument.spreadsheetml.sheet’; header(‘Content-Description: File Transfer’); header(‘Content-Type:

  • 0

This is right now I am using.

$mimeType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
header('Content-Description: File Transfer');
header('Content-Type: ' . $mimeType);
header('Content-Disposition: attachment; filename='.basename($type.'.xlsx'));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');   
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
print "$header\n$data";
exit;

$header variable contains the header row of excel to be generated and looks like this

$header= "Business_Name\tBusiness_Type\tType";

separated by \t

and $data contains rows to be generated under header columns. They are also separated by \t and a row is terminated by \n.

With the current setup file is downloaded but it is not opening with ms excel and showing this message.

Excel cannot open the file “file name”
because the file format or file
extension is not valid. Verify that
the file format has not been corrupted
and that the file extension matches
the format of the file.

What header should be sent to server? or how do I generate that file?

  • 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-22T21:05:45+00:00Added an answer on May 22, 2026 at 9:05 pm

    What you have is actually a CSV file. Depending on your OS, your browser and your Excel version, then the browser will differently let you or not let your open the extensions CSV, XLS XLSX with the Excel software.

    If you do want to have your data opened with Excel, then you can merge the data with an Excel template using OpenTBS. Use version 1.6.0 (or greater) which is currently in Release Candidate because it brings major facilities for Excel files.

    In your title there is “no excel library PHP”. I don’t know why you have this specification but OpenTBS is not exactly an Excel library. It’s a PHP tool for merging OpenOffice and Ms Office documents using templates.

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

Sidebar

Related Questions

I'm using markdown to edit this question right now. In some wikis I used
Right now I am using this to export a repeater (with multiple nested repeaters)
I am right now using this extended stored procedure in one of the test
I'm trying to make a dotted line. I'm using this right now for a
I'm a complete JavaScript noob. I am using this right now: $(function() { $(#tabs).tabs({
I'm using this right now: error_log(serialize(debug_backtrace())); But I have to unserialize it every time.
Right now im using this if statement, but i need to modify it so
I am using this right now... if($('.current').hasClass('odd') && !$('.current').hasClass('even')) { var oddMarL = $('.current
I'm learning this right now so the questions might be a little juvenile. Here's
I have this code right now to get the row value from jquery grid..

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.