I am trying to use an excel template file in Laravel to create new files. I seem to not be able to call certain methods and get errors like:
PHP Error: Call to undefined method PHPExcel_Worksheet::cells()
I can populate cells with data, but don't seem to be able to change any formatting.
Code looks like this:
Excel::load(storage_path('templates/consolidatedInvoice.xlsx'), function($excel) use($name, $invoice, $customer, $imported){
$excel->setActiveSheetIndex(0);
// deal with dates
$excel->getActiveSheet()
->setColumnFormat(array(
'E3' => 'dd-mmm-yyyy'));
$invDate = $invoice->ADPConsolidatedInvoice->importedInvoices->first();
$excel->getActiveSheet()
->setCellValue('E3', $invDate->formattedInvoiceDate)
->setCellValue('E4', $invoice->invoice_number)
Can anyone tell me what I am doing wrong?