PHP code example of vakata / spreadsheet
1. Go to this page and download the library: Download vakata/spreadsheet library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vakata / spreadsheet example snippets
php
// you can also write to browser or to stream (additional options are available for each format)
foreach (\vakata\spreadsheet\Writer::toFile('test.xlsx')->fromArray([
[1,"asdf","2022-02-10"],
[2,"test","2010-11-10"]
]);
// you can also read from stream
foreach (\vakata\spreadsheet\Reader::fromFile('test.xlsx') as $k => $row) {
var_dump($row);
}
// or
var_dump(\vakata\spreadsheet\Reader::fromFile('test.xlsx')->toArray());