Download Excel Message

Richard Korts
Richard Korts used Ask the Experts™
on
See attached message.

I get this every time I download an Excel spreadsheet generated in php with the following header:

header("Content-type: application/vnd.ms-excel");
$fn = "registrants" . date('Y-m-d_h_i') . ".xls";
header("Content-Disposition: attachment; filename=" . $fn);

If I change the file extension to xlsx will that solve this?

Thanks
excel-message.jpg
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2011
Top Expert 2016
Commented:
Maybe try changing to .csv instead.  CSV files are almost universally associated with Excel.  You might also try adding a header that tells the length of the file.  And, of course, check to be sure that the file really is a spreadsheet.

If you want to post the PHP script and the data it uses to create the Excel file we might be able to reproduce the issue and offer some more suggestions.
Richard KortsBusiness Owner / Chief Developer

Author

Commented:
Ray,

the spreadsheet is fine; it downloads & opens fine in Excel 16.

it's just the confusing message.

the customer gets confused.

Richard

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial