1. Go to this page and download the library: Download pittacusw/excel 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/ */
pittacusw / excel example snippets
use PittacusW\Excel\Excel;
class ExportUsersController
{
public function __invoke(Excel $excel)
{
return $excel->download(
rows: [
['name' => 'Ada', 'email' => '[email protected]'],
['name' => 'Grace', 'email' => '[email protected]'],
],
fileName: 'users',
);
}
}
use PittacusW\Excel\Facades\Excel;
$rows = Excel::import(
file: $request->file('users.xlsx'),
headingRow: 1,
);