excel - How to convert *.xlsb to array or *.csv using php -


i trying convert *.xlsb file php array or *.csv file (or @ least *.xls). tried use phpexcel, looks can not recognize what's inside file.

i noticed, can rename *.xlsb file *.zip file , unzip using command line unzip *.zip. , after next folders sheet1.bin file:

enter image description here

looks file should contain excel cell values, still can not parse using phpexcel. can me possible parse *.xlsb files , information it? or maybe possible parse sheet1.bin file?

phpexcel not support xlsb files. xlsb file format zip archive, same xlsx, majority of files inside archive binary files. binary files not easy parse.

an excel library php supports xlsb files easyxls. can download library here.

convert xlsb php array

//code reading xlsb file $workbook = new com("easyxls.exceldocument"); $workbook->easy_loadxlsbfile("file.xlsb");  //code building php array $xlstable = $workbook->easy_getsheetat(0)->easy_getexceltable(); ($row=0; $row<$xlstable->rowcount(); $row++) {    ($column=0; $column<$xlstable->columncount(); $column++)    {        $value = $xlstable->easy_getcell($row, $column)->getvalue();        //transfer $value array    } } 

or

//code reading xlsb file     $workbook = new com("easyxls.exceldocument"); $rows = $workbook->easy_readxlsbactivesheet_aslist("file.xlsb");  //code building php array ($rowindex=0; $rowindex<$rows->size(); $rowindex++)     {         $row = $rows->elementat($rowindex);         ($cellindex=0; $cellindex<$row->size(); $cellindex++)         {             $value = $row->elementat($cellindex);             //transfer $value array         }     } 

convert xlsb csv

//code reading xlsb file $workbook = new com("easyxls.exceldocument"); $workbook->easy_loadxlsbfile("file.xlsb");  //code converting csv $workbook->easy_writecsvfile("file.csv", $workbook->easy_getsheetat(0)->getsheetname()); 

convert xlsb xls

//code reading xlsb file $workbook = new com("easyxls.exceldocument"); $workbook->easy_loadxlsbfile("file.xlsb");  //code converting xls $workbook->easy_writexlsfile("file.xls"); 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -