Hello!
I load Excel template, than manipulate with data and after that save modified file in default exports folder.
Today I tried to use Laravel-Excel appendRow method, but got an error:
exception 'Maatwebsite\Excel\Exceptions\LaravelExcelException' with message '[ERROR] Reader
method [appendRow] does not exist.' in C:\OpenServer\domains\drugs.lar\
laravel\vendor\maatwebsite\excel\src\Maatwebsite\Excel\Readers\LaravelExcelReader.php:1275
My code:
$excelFilepath = Storage::disk('templates')->getDriver()->getAdapter()->applyPathPrefix('main.xlsx');
Excel::load($excelFilepath, function($doc) use ($test) {
//start line
$rowNumber = 6;
//test date
$testDate = Carbon::parse($test->date);
$sheet = $doc->setActiveSheetIndex(0);
$sheet->setCellValue('E3', $testDate->format('d.m.Y'));
$testEmployees = $test->employees;
//counter
$employeeCounter = 1;
foreach ($testEmployees as $employee) {
$doc->appendRow($rowNumber+1, array($employeeCounter,
$employee->employeeName
));
$employeeCounter++;
$rowNumber++;
}
})->setFilename($downloadkey)->store('xlsx');
I think that's because I can only use reader methods that described here:
https://github.com/Maatwebsite/Laravel-Excel/blob/700eba02f76f2971c81726a4f6a04121c1977e64/docs/import/basics.md
So... how I can use full power of this Laravel extension in my situation?
p.s. Of course, I can write all on the native PHPExcel's methods, but I want to write less code.
@patrickbrouwers Why this issue closed without any comment?
Most helpful comment
@patrickbrouwers Why this issue closed without any comment?