tbcd/excel-utils

Easy way to create Excel worksheets, spreadsheets and files

Maintainers

Package info

github.com/ThomasBeauchataud/ExcelUtils

pkg:composer/tbcd/excel-utils

Statistics

Installs: 52

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.1.1 2023-08-05 16:42 UTC

This package is auto-updated.

Last update: 2026-03-05 22:40:24 UTC


README

This library to easily create excel worksheets, spreadsheets and files.

Usage

  1. 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);
  1. 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');
  1. Get then result below

alt text