Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which is the best library to parse Excel files in PHP? [duplicate]

Possible Duplicate:
Alternative for PHP_excel

I've found a number of PHP libraries for reading and parsing Excel files, such as PHPExcel and PHP-Excel-Reader. Are there any other ones, and which is the best (i.e. the most robust, most update-to-date, etc.)?

like image 245
Jason Avatar asked Apr 27 '11 14:04

Jason


People also ask

How to read the Excel file in Php?

Loading a Spreadsheet File$inputFileName = './sampleData/example1. xls'; /** Load $inputFileName to a Spreadsheet Object **/ $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName); See samples/Reader/01_Simple_file_reader_using_IOFactory. php for a working example of this code.

How to read XLS and XLSX file in Php?

Read an Excel File (XLSX)​Browse each Sheet of the spreadsheet with $reader->getSheetIterator() Browse each Row of the Sheet with $sheet->getRowIterator() Browse each Cell of the Row with $row->getCells() Access each Value of the Cell with $cell->getValue()

How to write data in Excel file in Php?

You may use the following code: header('Content-Type: application/vnd. ms-excel'); header('Content-Disposition: attachment;filename="file. xlsx"'); header('Cache-Control: max-age=0'); $writer->save('php://output');


1 Answers

Definition of which is the best is very subjective... I have a vested interest when I say that PHPExcel is the best, because I'm the main developer. However:

  • very few of the packages listed in this thread are still actively supported
  • work only with one or other format of Excel files (BIFF .xls or Office Open XML .xlsx)
  • can only read, or only write
  • or require third-party plug-ins, or specific operating platforms

Best is a very subjective term, and it really depends on your exact requirements including

  • whether you are able to use (for example) COM to interact directly with MS Excel on the server
  • or need to both read and write Excel
  • or need to work with xls, or xlsx or both formats
  • or care about ongoing development/support
like image 196
Mark Baker Avatar answered Nov 11 '22 15:11

Mark Baker