tbcd / excel-utils
Easy way to create Excel worksheets, spreadsheets and files
1.1.1
2023-08-05 16:42 UTC
Requires
- php: >=8.1.0
- ext-ctype: *
- ext-iconv: *
- phpoffice/phpspreadsheet: ^1.19
- symfony/filesystem: ^6.0
Requires (Dev)
- phpunit/phpunit: ^9.5|^10.0
This package is auto-updated.
Last update: 2025-04-05 20:36:07 UTC
README
This library to easily create excel worksheets, spreadsheets and files.
Usage
- Inject the service from container if you have one or create it
private ExcelFileFactory $excelFileFactor;
public function __construct(ExcelFileFactory $excelFileFactory)
{
$this->excelFileFactory = $excelFileFactory;
}
$excelFileFactory = new ExcelFileFactory($spreadsheetFactory);
- Create the file with your data
$data = [
[
'column1' => 'row1',
'column2' => 'row1',
'column3' => 'row1'
],
[
'column1' => 'row2',
'column2' => 'row2',
'column3' => 'row2'
]
];
$filePath = $fileFactory->createFileWithData(new WorksheetData($data, 'my-sheet-name'), 'my_file.xlsx');
- Get then result below