mostafazs / php-excel2any
将 Excel 转换为 CSV
1.0.2
2022-09-29 19:28 UTC
Requires
- php: >=7.2.1
- phpoffice/phpspreadsheet: ^1.19
Requires (Dev)
- phpunit/phpunit: 6.*
This package is auto-updated.
Last update: 2024-09-30 01:30:33 UTC
README
PHP Excel2Any
将 Excel 转换为 CSV
安装
使用 composer
进行安装
composer require mostafazs/php-excel2any
或者
在项目的 composer.json
文件中使用 composer 安装此包
"require": { "mostafazs/php-excel2any": "1.*" }
使用方法
<?php include("./vendor/autoload.php"); use excel2any\excel2any; use excel2any\RealRead; use excel2any\Formats\FormatCSV; use excel2any\Saver\SaveCSV; $filename = __DIR__."/Products.xlsx";//Excel file name $config = [ "startRow"=>1,//Excel file start row "endRow"=>37,//Excel file end row "inputFileType"=>"Xlsx",//dont change "inputFileName"=>$filename,//Excel file name "sheetname"=>"Sheet1",//Default sheet name "range_start"=>"A",//Column start from "range_end"=>"AM",//Column end to ]; $excel = new excel2any(); //Read excel file $excel_read = new RealRead($config); $readed = $excel_read->Read(); //Select Format Output Format..and pass read data $csvFormat = new FormatCSV(); $csvdata = $csvFormat->Format($readed); //Save Saver Class $savecsv = new SaveCSV(); //Save File..pass $savecsv , $csvdata and input file name $result = $excel->convert()->save($savecsv,$csvdata,$config['inputFileName']); if($result){ echo "CSV File created"; } ?>
问题
测试
> phpunit tests
许可证
MIT
待办事项
编写测试
捐赠
你的星标很重要
如果你觉得这个包很有用,并想鼓励我维护和改进它,只需按下星标按钮以表达你的意愿。用一杯茶奖励我吧 🍵
在你国家,请捐赠相当于一杯茶的价值,这样我就会有精力维护这个包。
Ethereum: 0x311B3d573CC839f79CB48D01b67eA09CCfA5aC48