Category : laravel-excel

When I am importing data from excel after getting the file and on the step of saving data to db it showing field doesn’t have value. Where as all the fields are filled with data. i am using laravel excel LeadImport Code return new lead([ ‘name’ => $row[0], ‘leadid’ => $row[1], ‘number’ => $row[2], ‘city’ ..

Read more

I have an export class that worked on XLSX and CSV, but doesn’t work on PDF. It’s return: ErrorException Undefined array key 0 My class is: class InvoicesExport implements FromQuery, WithHeadings, WithEvents { public function headings(): array { return [ [‘First row’], [‘Second row’, ‘Second row’], ]; } public function registerEvents(): array { return [ ..

Read more

When using Laravel Excel 3.1 for exporting data it should format dates to dates and time to time. However both date and time are turned into Custom. I have the following export: class Export implements FromView, WithEvents { public static function afterSheet( AfterSheet $event ): void { $sheet = $event->getSheet(); $sheet->formatColumn( ‘H’, NumberFormat::FORMAT_DATE_YYYYMMDD2 ); $sheet->formatColumn( ..

Read more

I have a file ExcelConclusions.php in path: /app/Library/Excel with content: <?php namespace AppLibrary; use AppLibraryExcel; use MaatwebsiteExcelConcernsWithHeadings; class ExcelConclusions extends Excel implements WithHeadings {} I always get this error: FatalErrorException in ExcelConclusions.php line 18: Interface ‘MaatwebsiteExcelConcernsWithHeadings’ not found How to import this interface? There is row in providers: [MaatwebsiteExcelExcelServiceProvider::class] I have used this instruction. Source: ..

Read more

I’m using Laravel 5.8 and laravel-excel for exporting some data into an Excel file. So I added this method to the Model: public static function getAccounts($id) { $records = DB::table(‘members’) ->where(‘mys_creator_id’,$id) ->where(‘mys_olp_id’,4) ->join(‘my_students’, ‘members.mbr_usr_id’, ‘=’, ‘my_students.mys_mbr_id’) ->join(‘students’, ‘members.mbr_usr_id’, ‘=’, ‘students.std_mbr_id’) ->select(‘members.mbr_name’, ‘members.mbr_family’, ‘members.mbr_father_name’,’members.mbr_national_code’,’members.mbr_birthday’,’members.mbr_phone’,’members.mbr_mobile’,’members.mbr_post_code’,’members.mbr_prv_id’,’members.mbr_cit_id’,’members.mbr_gender_id’,’members.mbr_address’,’students.std_degree_id’,’students.std_grade_id’,’students.std_filed_id’,’students.std_major_id’,’students.std_school’,’students.std_education_type_id’,’my_students.mys_paid_price’) ->get()->toArray(); return $records; } And this works fine but some of data ..

Read more

I want to hide program_code column in excel file when importing. What should I do? I’m using ToModel for Class Import. ProgramImport.php public function __construct(string $program_code) { $this->program_code = $program_code; } public function model(array $row) { $row[‘program_code’] = $this->program_code; return new ProgramDetail([ ‘program_detail_no’ => $row[‘number’], ‘program_detail_code’ => $row[‘program_code’], ‘program_detail_subject’ => $row[‘subject_code’], ‘program_detail_semester’ => $row[‘semester’], ‘program_detail_note’ ..

Read more

I’m using Laravel 5.8 and I have installed "maatwebsite/excel": "^3.1" and made an Export class goes like this: class ConfirmedExport implements FromCollection, WithHeadings { public function headings():array{ return [ ]; } /** * @return IlluminateSupportCollection */ public function collection() { return collect(WithdrawWallet::getData()); } } And here is my Model method: public static function getData() { ..

Read more