Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gentritabazi/php-spreadsheet-excel

Build Excel In PHP Easy And Fast.
https://github.com/gentritabazi/php-spreadsheet-excel

laravel-csv laravel-excel php-csv php-excel php-spreadsheet php-spreadsheet-excel

Last synced: 29 days ago
JSON representation

Build Excel In PHP Easy And Fast.

Awesome Lists containing this project

README

        

### Introduction

**PhpSpreadsheetExcel** is a package thats offers you to build Excel fast and easy in PHP.

This package depends on [PHPOffice/PhpSpreadsheet](https://github.com/PHPOffice/PhpSpreadsheet).

### Installation
* composer require **gentritabazi01/phpspreadsheetexcel**.

### Usage

[Example 1](src/Examples/example-01.php):

```php
createSheet('Sheet 1', $columns, $rows, $config);
$spreadsheetExcel->save('file.xlsx');
```

Output:

![...](screenshots/example-01.png)

[Example 2](src/Examples/example-02.php):

```php
'Hello World',
'auto_numbering' => true,
'columns_autosize' => true,
'columns_auto_filter' => true,
'borders' => true
];

$spreadsheetExcel = new PhpSpreadsheetExcelService();
$spreadsheetExcel->createSheet('Sheet 1', $columns, $rows, $config);
$spreadsheetExcel->save('file.xlsx');
```

Output:

![...](screenshots/example-02.png)

[Example 3](src/Examples/example-03.php):

```php
toArray();
$config = ['columns_autosize' => true];

$spreadsheetExcel = new PhpSpreadsheetExcelService();
$spreadsheetExcel->createSheet('Sheet 1', $columns, $rows, $config);
$spreadsheetExcel->download('file.xlsx');
}
}
```

Output:

![...](screenshots/example-03.png)

[Example 4](src/Examples/example-04.php):

```php
true];

$parsedRows = $rows->map(function($row) {
$parsedRow['id'] = ['value' => $row['id']];
$parsedRow['name'] = ['value' => $row['name']];
$parsedRow['email'] = ['value' => $row['email']];

// Style row - https://phpspreadsheet.readthedocs.io/en/latest/topics/recipes/#styles
if($row['name'] == 'Gentrit') {
$parsedRow['name']['style'] = [
'font' => ['color' => ['rgb' => 'FF0000']]
];
}

return $parsedRow;
});

$spreadsheetExcel = new PhpSpreadsheetExcelService();
$spreadsheetExcel->createSheet('Sheet 1', $columns, $parsedRows, $config);
$spreadsheetExcel->download('file.xlsx');
}
}
```

Output:

![...](screenshots/example-04.png)

### Available Functions
* stream.
* streamAsCsv.
* save.
* createSheet.
* download($fileName | 'file.xlsx').
* downloadAsCsv($fileName | 'file.csv').