PHP code example of gcordonpgva / sheet-excel-import
1. Go to this page and download the library: Download gcordonpgva/sheet-excel-import 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/ */
gcordonpgva / sheet-excel-import 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');
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');
$header_style = (new StyleBuilder())->setFontBold()->build();
$rows_style = (new StyleBuilder())
->setFontSize(15)
->setShouldWrapText()
->setBackgroundColor("EDEDED")
->build();
return (new FastExcel($list))
->headerStyle($header_style)
->rowsStyle($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.