1. Go to this page and download the library: Download digitools/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/ */
use Me\FastExcel\FastExcel;
$collection = (new FastExcel)->import('users.xlsx');
$collection->each(function ($row) {
// Process each row
User::create($row);
});
use Me\FastExcel\FastExcel;
$data = User::all();
(new FastExcel($data))->export('users.xlsx', function ($user) {
return [
'Full Name' => $user->name,
'Email Address' => $user->email,
];
});
use Me\FastExcel\FastExcel;
$users = (new FastExcel)->import('users.xlsx', function ($row) {
return User::create([
'name' => $row['Full Name'],
'email' => $row['Email Address'],
]);
});
use Me\FastExcel\FastExcel;
(new FastExcel(User::query()->cursor()))->export('large-users.xlsx');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.