maatwebsite-excel

Laravel maat excell unable to access stored csv file

心已入冬 提交于 2019-12-11 16:31:13
问题 Laravel 5.6.39 Matt Excel 3.1 I am able to store the csv file on storage/app/public directory using $excel = (new ReportExport($results))->store('public/' . $fileName, 'local'); updated my code to 3.1 $excel = Excel::store(new ReportExport($results), 'public/' . $fileName, 'local'); I also created the simlink uisng php artisan storage:link as described in doc and able to get the correct link to file using $path = asset('storage/app/public/' . $fileName); but if I am trying to use this link in

How to get excel to array in maatwebsite

南楼画角 提交于 2019-12-10 07:14:39
问题 I am trying to convert an Excel file to an array using the latest version of Laravel-Excel (3.1.9) The code below will download the file: return Excel::download(new SalesOrderExport('columns'),'test.xlsx') But I need to convert it to get an array only. I don't want to store this Excel data in a database at this point. I tried with the code below but it did not work as the load method is not available in version 3. Excel::load($request->file('sampledata'), function ($reader) { return response(

Laravel : UTF-8 issue while exporting CSV

浪子不回头ぞ 提交于 2019-12-08 07:19:21
问题 While trying to export data form database I saw some garbage value instead of showing the actual data which is UTF-8 character. I used Excel for opening the csv and I used Maatwebsite/Laravel-Excel package for exporting the csv. Here is my controller : public function downloadExcel($type) { $data = Item::get()->toArray(); return Excel::create('solutionstuff_example', function($excel) use ($data) { header('Content-Encoding: UTF-8'); header('Content-type: text/csv; charset=UTF-8'); header(

Laravel excel 3.1 add extra rows betweem iterations

老子叫甜甜 提交于 2019-12-02 15:52:42
问题 Sorry for my english. I have one to many relationship between two tables one is "alquileres" (rents) and the other is "cobros" (payments). I need to show the totals of each rental like this: what i need But obtain this: result This is the code of my export: class ComprobantesExport implements FromCollection, WithMapping, WithHeadings, ShouldAutoSize, WithEvents { use Exportable, RegistersEventListeners; protected $alquileres; public function __construct($alquileres = null) { $this->alquileres

Laravel excel 3.1 add extra rows betweem iterations

岁酱吖の 提交于 2019-12-02 09:08:11
Sorry for my english. I have one to many relationship between two tables one is "alquileres" (rents) and the other is "cobros" (payments). I need to show the totals of each rental like this: what i need But obtain this: result This is the code of my export: class ComprobantesExport implements FromCollection, WithMapping, WithHeadings, ShouldAutoSize, WithEvents { use Exportable, RegistersEventListeners; protected $alquileres; public function __construct($alquileres = null) { $this->alquileres = $alquileres; } /** * @return \Illuminate\Support\Collection */ public function collection() { return

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

ぃ、小莉子 提交于 2019-11-29 18:09:37
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 height of row automatic added based content/text. But it does not added How can I solve this problem?

Call to undefined method Maatwebsite\Excel\Excel::load()

半腔热情 提交于 2019-11-27 06:55:20
问题 I'm trying to import excel file (.xlsx) using maatwebsite 3.0. How to fix This error Call to undefined method Maatwebsite\Excel\Excel::load() My controller public function importsave(Request $request) { if($request->hasFile('excel')) { $path = $request->file('excel')->getRealPath(); $data= Excel::load($path, function($reader) {})->get(); if(!empty($data) && $data->count()) { foreach($data->toArray() as $key=>$value) { if(!empty($value)) { Employee::insert($value); } } } } } 回答1: Version 3.0