PHP code example of heyaender / excelintar-reader
1. Go to this page and download the library: Download heyaender/excelintar-reader 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/ */
heyaender / excelintar-reader example snippets
$excel = Excel::open($file);
$sheet = $excel->getSheet('Articles');
$sheet->setReadArea('B5');
foreach ($sheet->nextRow() as $rowNum => $rowData) {
$user = User::create([
'name' => $rowData['B'],
'birthday' => new \Carbon($rowData['C']),
'password' => bcrypt($rowData['D']),
]);
Article::create([
'user_id' => $user->id,
'title' => $rowData['E'],
'date' => new \Carbon($rowData['F']),
'public' => $rowData['G'] === 'yes',
]);
}