So I have a lot of sheets from an xls file, that I need exactly the same format and numbers, but it says that I cannot insert the sheets into the destination workbook because it contains fewer rows and columns than the source workbook
Why can't I export a OneDrive Excel file as .xls or .xlsx?
Download xlsx file using php - Stack Overflow
How do you convert an excel file with suffix xlsx to xls
I want to copy a sheet from an xls file into a xlsx file. Do you know how to do it?
Videos
Thank you for this quick response, Shakiru. I do appreciate it!
I was under the mistaken impression that a subscription to Microsoft OneDrive was a substitute to purchasing Mircrosoft Office for my laptop and therefor allowed me the full capabilities of Microsoft Office. Now I'm wondering what is the benefit of OneDrive.
Thank you for clarifying things for me, Shakiru.
Ingrid
Hi Ingrid A!
You are very much welcome.
Best Regards, Shakiru
After many years, I got same problem, and after searching, I got here again ))
This is solution, that worked for me:
$file = "somefile.xlsx";
// define file $mime type here
ob_end_clean(); // this is solution
header('Content-Description: File Transfer');
header('Content-Type: ' . $mime);
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"" . basename($file) . "\"");
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
readfile($file);
You must be using this code in middle of some other file.
The problem with headers is they need to be set first on a page. They will not work if you have even 1 single space echoing before them. So you need to ob_clean() [clean the buffer] before you are setting headers
Try
ob_clean();
flush();
$file = "somefile.xlsx";
header('Content-Description: File Transfer');
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
readfile($file);