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

藏色散人
Release: 2023-04-07 12:22:02
forward
3595 people have browsed it

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();
Copy after login

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,
]));
Copy after login

Benchmark test

Test environment:

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

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!

Related labels:
php
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!