laravel-excel

Laravel excel get total number of rows before import

徘徊边缘 提交于 2020-01-04 13:05:50
问题 Straight forward question. How does one get the total number of rows in a spreadsheet with laravel-excel? I now have a working counter of how many rows have been processed (in the CompanyImport file), but I need the total number of rows before I start adding the rows to the database. The sheet I'm importing is almost 1M rows, so I am trying to create a progress bar. My import: public function model(array $row) { # Counter ++$this->currentRow; # Dont create or validate on empty rows # Bad

Laravel excel not exporting in correct format

家住魔仙堡 提交于 2019-12-29 09:37:33
问题 I currently have an array that I've built that dumps like this: 0 => array:11 [▼ "category_code" => "123" "category_name" => "Testing" "category_description" => "This is a test category" 19738 => array:5 [▼ "identifier" => "720368842943" "description" => Test Description One "count" => 4 "details" => array:2 [▼ 0 => array:3 [▼ "detail_code" => "2751" "detail_code2" => "43" "detail_specifier" => "Detail One" ] 1 => array:3 [▼ "detail_code" => "2681" "detail_code2" => "9" "detail_specifier" =>

How do I make automatic height row based on content in the maatwebsite version 3 laravel excel?

好久不见. 提交于 2019-12-29 09:31:56
问题 I had search reference and the reference say to try like this : <?php ... class ReportExport implements ShouldAutoSize, FromView, WithColumnFormatting, WithEvents { ... public function registerEvents(): array { return [ AfterSheet::class => function(AfterSheet $event) { ... $event->sheet->getDelegate()->getRowDimension(37)->setRowHeight(-1); $event->sheet->getDelegate()->getStyle('R37:Z37')->getAlignment()->setWrapText(true); }, ]; } } I try like that, but the result like this : Should the

(maatwebsite) Laravel-excel. Is it possible to get the latest active row (or cell) while working with a blade view?

徘徊边缘 提交于 2019-12-24 14:28:32
问题 I'm working with laravel-excel, previously I used it creating a new sheet from scratch, so I was always able to know in which row I was by just using a variable ($row). Now I'm exploring the other way of using it, by using a blade view, and it works great, but I want to do some transformations and add some formulas from the laravel-excel side (class side), the problem is that by using a view I lost control for knowing which row am I "standing" in. I know how to pass variables to the view but

Laravel-Excel massive import

ぃ、小莉子 提交于 2019-12-23 20:19:29
问题 So, I have an excel file with 28k rows. I want to load it, then insert into database, but it was just stopped. (blank space) I've tried to reduce into 5k data, and it worked, but is too slow I also tried using chunk, with only 5k data, but I got "Maximum execution time of 300 seconds exceeded". here's the code Excel::filter('chunk')->load(storage_path('excel/exports/').$fileName)->chunk(1000, function($results) { foreach($results as $key) { // even nothing to do } }); Is 5k row really that

How can I change color a character laravel excel maatwebsite?

陌路散爱 提交于 2019-12-22 10:06:56
问题 I get tutorial from here : https://laravel-excel.maatwebsite.nl/3.0/exports/extending.html So I use version 3 My excel like this : I want to change it to be like this : So I want the character England change to red color and bold I try like this : namespace App\Exports; ... use Maatwebsite\Excel\Concerns\WithEvents; use Maatwebsite\Excel\Events\BeforeExport; use Maatwebsite\Excel\Events\AfterSheet; class SummaryExport implements FromView, WithEvents { ... public function registerEvents():

Laravel Excel how to load a view to specific row or cell?

喜夏-厌秋 提交于 2019-12-22 04:15:11
问题 I'm using Laravel Excel, I want to load a view file and set it to specific row. Is it possible to do it with laravel excel? bellow is the code for loading view in to the sheet: Excel::create('New file', function($excel) { $excel->sheet('New sheet', function($sheet) { $sheet->loadView('folder.view'); }); }); 回答1: It seems like the package doesn't offer that I this time but maybe you could do something like this. Create a wrapping view that you can pass some parameters to, such as a target row

Ambiguous class resolution in laravel phpexcel update

可紊 提交于 2019-12-22 03:50:12
问题 I try to update the laravel with php excel while installing i found the below warning in the composer. Error: Warning: Ambiguous class resolution, "SettingsController" was found in both "C:\xampp\htdocs\mti\app\controllers\SettingsController.php" and "C:\xampp\htdocs\mti\app\controllers\SettingsControllerBackup.php", the first will be used.Warning: Ambiguous class resolution, "ClassModel" was found in both "C:\xampp\htdocs\mti\app\models\ClassModel.php" and "C:\xampp\htdocs\mti\ app\models

Laravel Excel html to excel conversion not working

和自甴很熟 提交于 2019-12-20 07:10:18
问题 I'm using Laravel 5.6 version and laravel-excel.maatwebsite version 3.1. I want to convert html to excel file. In official documentation they have not given enough information to convert html views to excel. I'm having hard time. Below is the Code for App\Exports\AttendanceExport <?php namespace App\Exports; use App\Models\Student\StudentAttendenceModel; use Illuminate\Contracts\View\View; use Maatwebsite\Excel\Concerns\FromView; use Maatwebsite\Excel\Concerns\FromCollection; class

How can I set text align right in the column on the laravel Excel maatwebsite?

♀尐吖头ヾ 提交于 2019-12-18 09:38:39
问题 I get reference from here : https://laravel-excel.maatwebsite.nl/3.0/getting-started/ I have been looking for how to set the text align right, but I did not find it in the documentation My script export like this : <?php namespace App\Exports; use Maatwebsite\Excel\Concerns\Exportable; use Illuminate\Contracts\View\View; use Maatwebsite\Excel\Concerns\FromView; class InvoiceExport implements FromView { use Exportable; public function view(): View { $data = Invoice::get(); return view('exports