In this article we will learn on how we can read Microsoft Excel Sheet in PHP. To achieve this we will be using Open Source Tool PHPExcelReader. It provides us with necessary API that allow us to read the Excel Sheet in PHP.
Directory Structure for ExcelReader:
When you will unzip the excelreader, you will find example.php that shows us how to read excel sheet using php code. And the most important thing is the Excel folder, it contains all the necessary files and API that will actually perform your operation. Keep the Excel folder as it is as files are included in the API code as per the directory structure.
Well the included example.php is sufficient to understand the functionality of the ExcelReader. But i am showing the same code here with slight modification.
$data = new Spreadsheet_Excel_Reader();
// Set output Encoding.
* if you want you can change 'iconv' to mb_convert_encoding:
* By default rows & cols indeces start with 1
* For change initial index use:
* Some function for formatting output.
columns with unknown formatting
* $data->setColumnFormat(4, '%.3
* setDefaultFormat - set format fo
* setColumnFormat - set format for column (apply only to number fields)