Skip to content

Commit afb76f1

Browse files
committed
upd readme
1 parent fdaff9e commit afb76f1

File tree

2 files changed

+46
-5
lines changed

2 files changed

+46
-5
lines changed

README.md

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
1-
FastExcelLaravel
2-
Lightweight and very fast XLSX Excel Spreadsheet Writer for Laravel
3-
(wrapper for [FastExcelWriter](https://packagist.org/packages/avadim/fast-excel-writer))
1+
# FastExcelLaravel
2+
3+
Lightweight and very fast XLSX Excel Spreadsheet read/write library for Laravel in pure PHP
4+
(wrapper around [FastExcelWriter](https://packagist.org/packages/avadim/fast-excel-writer)
5+
and [FastExcelReader](https://packagist.org/packages/avadim/fast-excel-reader))
46

57
## Introduction
68

79
Exporting data from your Laravel application has never been so fast! Importing models into your Laravel application has never been so easy!
810

9-
This library is a wrapper for avadim/fast-excel-writer фтв avadim/fast-excel-куфвук, so it's also lightweight, fast, and requires a minimum of memory.
10-
Using this library, you can export arrays, collections and models to a XLSX-file from your Laravel application.
11+
This library is a wrapper around **avadim/fast-excel-writer** and **avadim/fast-excel-reader**, so it's also lightweight, fast, and requires a minimum of memory.
12+
Using this library, you can export arrays, collections and models to a XLSX-file from your Laravel application, and you can import data to Laravel application.
13+
14+
**Features**
15+
16+
* Easily export models, collections and arrays to Excel
17+
* Export huge datasets with very fast, and using a minimum of memory
18+
* Сan create multiple sheets and supports basic column, row and cell styling
19+
* You can set the height of the rows and the width of the columns (including auto width calculation)
20+
* Import workbooks and worksheets to Eloquent models very quickly and with minimal memory usage
21+
* Automatic field detection from imported table headers
1122

1223
## Installation
1324

@@ -29,6 +40,18 @@ $excel->saveTo('path/file.xlsx');
2940
$excel->store('disk', 'path/file.xlsx');
3041
```
3142

43+
Jump To:
44+
* [Export Data](#export-data)
45+
* [Export a Model](#export-a-model)
46+
* [Export Any Collections and Arrays](#export-any-collections-and-arrays)
47+
* [Advanced Usage for Data Export](#advanced-usage-for-data-export)
48+
* [Import Data](#import-data)
49+
* [Import a Model](#import-a-model)
50+
* [Advanced Usage for Data Import](#advanced-usage-for-data-import)
51+
* [More Features](#more-features)
52+
* [Do you want to support FastExcelLaravel?](#do-you-want-to-support-fastexcellaravel)
53+
54+
3255
## Export Data
3356

3457
### Export a Model
@@ -151,7 +174,9 @@ $excel->saveTo($testFileName);
151174
### Import a Model
152175
To import models, you can use method ```importModel()```.
153176
By default, the first row is considered to contain the names of the fields
177+
154178
![import.jpg](import.jpg)
179+
155180
```php
156181
// Open XLSX-file
157182
$excel = Excel::open($file);
@@ -192,6 +217,7 @@ See detailed documentation for avadim/fast-excel-reader here: https://github.com
192217
$excel = Excel::open($file);
193218

194219
$sheet = $excel->getSheet('Articles');
220+
$sheet->setReadArea('B5');
195221
foreach ($sheet->nextRow() as $rowNum => $rowData) {
196222
$user = User::create([
197223
'name' => $rowData['B'],
@@ -207,6 +233,10 @@ foreach ($sheet->nextRow() as $rowNum => $rowData) {
207233
}
208234
```
209235

236+
## More Features
237+
You can see more features for export in the documentation for [FastExcelWriter](https://packagist.org/packages/avadim/fast-excel-writer).
238+
239+
You can see more features for import in the documentation for [FastExcelReader](https://packagist.org/packages/avadim/fast-excel-reader))
210240

211241
## Do you want to support FastExcelLaravel?
212242

tests/FastExcelLaravelTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,5 +345,16 @@ public function testLoadModel()
345345
$this->assertEquals('Captain Jack Sparrow', FakeModel::$storage[2]->foo);
346346
$this->assertEquals('1753-01-31', FakeModel::$storage[2]->bar);
347347
$this->assertEquals(7239, FakeModel::$storage[2]->int);
348+
349+
$sheet = $excel->sheet();
350+
$sheet->setReadArea('b5');
351+
$result = [];
352+
foreach ($sheet->nextRow() as $rowNum => $rowData) {
353+
$result[$rowNum] = $rowData;
354+
}
355+
$this->assertCount(3, $result);
356+
$this->assertEquals('James Bond', $result[5]['B']);
357+
$this->assertEquals('Ellen Louise Ripley', $result[6]['B']);
358+
$this->assertEquals('Captain Jack Sparrow', $result[7]['B']);
348359
}
349360
}

0 commit comments

Comments
 (0)