Home>Article>Backend Development> PHP high-performance Excel extension 1.2.8 released, file reading data type controllable!

PHP high-performance Excel extension 1.2.8 released, file reading data type controllable!

藏色散人
藏色散人 forward
2019-09-17 15:20:27 3708browse

PHP high-performance Excel extension 1.2.8 released, file reading data type controllable!

Why use xlswriter

xlswriter is a PHP C extension that can be used to read in Excel 2007 XLSX files Data, insert multiple worksheets, write text, numbers, formulas, dates, charts, pictures and hyperlinks.

Please refer to the comparison chart below; due to memory reasons, PHPExcel and PHPSpreadSheet cannot work properly when the amount of data is relatively large. Although the memory problem can be solved by modifying the memory_limit configuration, the time to complete the work may be Longer;

PHP high-performance Excel extension 1.2.8 released, file reading data type controllable!

It supports the following functions:

1. Writing

● 100% compatible Excel XLSX file

● Complete Excel format

● Merge cells

● Define worksheet name

● Filter

● Chart

● Data validation and drop-down list

● Worksheet PNG/JPEG image

● Memory optimization mode for writing large files

● Works with Linux, FreeBSD, OpenBSD, OS

##2. Reading

● Read the data completely

● Read the data with the cursor

● Read by data type

1.2.8 New features

1. New date writing

$config = [ 'path' => './tests' ]; $fileObject = new \Vtiful\Kernel\Excel($config); $fileObject = $fileObject->fileName('tutorial.xlsx'); $filePath = $fileObject->header(['date']) ->insertDate(1, 0, time(), 'mmm d yyyy hh:mm AM/PM') ->output();

2. New custom cell data type reading

$config = [ 'path' => './tests', ]; $fileObject = new \Vtiful\Kernel\Excel($config); $fileObject->openFile('tutorial.xlsx') ->openSheet(); var_dump($fileObject->nextRow([ \Vtiful\Kernel\Excel::TYPE_STRING, \Vtiful\Kernel\Excel::TYPE_TIMESTAMP, ]));

Benchmark test

Test environment:

Macbook Pro 13 inch Intel Core i5 16GB 2133MHz LPDDR3 Memory 128GB SSD Storage.

Export

Two memory modes, export 100W rows of data, 27 columns in a single row, 19 Chinese characters per cell

● Regular mode: takes 29S, memory usage is 2083MB;

● Fixed memory mode: takes 52S, memory usage

Read

Read 100W rows of data, each row has 1 column, the cell data is int

● Full read: takes 3S, memory usage 558MB;

● Cursor read: takes 2.8S, memory usage

Warehouse address

Github:

https ://github.com/viest/php-ext-excel-export

Gitee:https://gitee.com/viest/php-ext-xlswriter

PECL:https://pecl.php.net/package/xlswriter

Documentation

https:/ /xlswriter-docs.viest.me

End

Finally please don’t forget star

For more PHP knowledge, please visit PHP Chinese website

PHP tutorial

!

The above is the detailed content of PHP high-performance Excel extension 1.2.8 released, file reading data type controllable!. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete