PHP code example of endroid / simple-spreadsheet
1. Go to this page and download the library: Download endroid/simple-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/ */
endroid / simple-spreadsheet example snippets
use Endroid\SimpleSpreadsheet\Adapter\FileAdapter;
use Endroid\SimpleSpreadsheet\SimpleSpreadsheet;
$spreadsheet = new SimpleSpreadsheet();
$spreadsheet->load('data.xlsx'); // Load all sheets from data.xlsx
$spreadsheet->load([
'Players' => [
['name' => 'L. Messi', 'club' => 'Barcelona'],
['name' => 'C. Ronaldo', 'club' => 'Real Madrid']
]
]);
$spreadsheet->save(FileAdapter::class, ['Players'], ['filename' => 'players.csv']);