From the course: PHP: Exporting Data to Files
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Downloading the data as a .xlsx file - PHP Tutorial
From the course: PHP: Exporting Data to Files
Downloading the data as a .xlsx file
We've written a lot of code, so it's a good idea to comment the script before we forget what it's all about. We began by setting the metadata for the spreadsheet. So let's add a new line in here, and then on line 8, set metadata. Next, we set the default settings. That began on line 13. And then we've got a reference to the active spreadsheet within an xl workbook. And if we scroll down the next thing was to set the Print options. These included the Page Orientation and headers and footers. The next step was to populate the spreadsheet with data. And we began with setting the column headings. And then the do while loop that populated individual cells. And then we formatted individual columns. If we just tidy that up there. And the last thing that we did was to give the spreadsheet a title. So, finally, we're ready to generate an excel file and download it. First thing that we need to do before downloading is to tell the browser what sort of file to expect by sending some http headers.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Introducing PHPExcel3m 31s
-
Setting properties and defaults in PHPExcel6m 58s
-
Setting the spreadsheet's print options5m 59s
-
Populating an Excel spreadsheet with data7m 46s
-
Formatting columns in PHPExcel5m 47s
-
Downloading the data as a .xlsx file5m 18s
-
Creating a spreadsheet in the OpenDocument format3m 4s
-
Creating columns and headers in Fusonic SpreadsheetExport6m 26s
-
Adding the data and downloading as a .ods file6m 52s
-
-
-
-
-
-