1. Go to this page and download the library: Download rap2hpoutre/fast-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/ */
rap2hpoutre / fast-excel example snippets
use Rap2hpoutre\FastExcel\FastExcel;
use App\User;
// Load users
$users = User::all();
// Export all users
(new FastExcel($users))->export('file.xlsx');
$sheets = (new FastExcel)->importSheets('file.xlsx');
$users = (new FastExcel)->sheet(3)->import('file.xlsx');
$sheets = (new FastExcel)->withSheetsNames()->importSheets('file.xlsx');
function usersGenerator() {
foreach (User::cursor() as $user) {
yield $user;
}
}
// Export consumes only a few MB, even with 10M+ rows.
(new FastExcel(usersGenerator()))->export('test.xlsx');
use OpenSpout\Common\Entity\Style\Style;
$header_style = (new Style())->setFontBold();
$rows_style = (new Style())
->setFontSize(15)
->setShouldWrapText()
->setBackgroundColor("EDEDED");
return (new FastExcel($list))
->headerStyle($header_style)
->rowsStyle($rows_style)
->download('file.xlsx');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.