“Utwórz plik Excel za pomocą PHP]” Kod odpowiedzi

Utwórz plik Excel za pomocą PHP]

$books = [
    ['ISBN', 'title', 'author', 'publisher', 'ctry' ],
    [618260307, 'The Hobbit', 'J. R. R. Tolkien', 'Houghton Mifflin', 'USA'],
    [908606664, 'Slinky Malinki', 'Lynley Dodd', 'Mallinson Rendel', 'NZ']
];
$xlsx = SimpleXLSXGen::fromArray( $books );
$xlsx->saveAs('books.xlsx');
//  $xlsx->downloadAs('books.xlsx');
//git repo given below 
uzii

Jak użyć pliku odczytu PHP Excel

Mark Baker was extremely helpful in guiding me to the right answer. I don't use Composer with PHP (I should probably learn), but given that, in order to get this to work I went to the GitHub page for PHPExcel (https://github.com/PHPOffice/PHPExcel), clicked the green Clone and download button, and then the Download ZIP link.

After unzipping the file, I got a folder called PHPExcel-1.8. I moved that folder to the same folder as both the Excel file I wanted to read (in my code below test.xlsx) and the PHP file that has the code below.

The key to getting it to work was inputting the correct path to the IOFactory.php file. It may seem simple to some, but it was tripping me up.
Santino

Odpowiedzi podobne do “Utwórz plik Excel za pomocą PHP]”

Pytania podobne do “Utwórz plik Excel za pomocą PHP]”

Więcej pokrewnych odpowiedzi na “Utwórz plik Excel za pomocą PHP]” w PHP

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu