Get data from excel with PHP

by Metin ERBEK

Posted on 2019-05-01 01:22:12

For download all project source code click here


I want tell you, how get data from .xls excel files systematically by PHP. First of all this is for just old version excel ( .xls extension ) files. Usually we need reading from excel for our CRM cıstomer datas, import big datas to our databases etc.

I will use Php Excel Reader for reading datas. Downloading script and including my script firstly and creating Spreadsheet_Excel_Reader object.

require("reader.php"); // php excel reader
$connection=new Spreadsheet_Excel_Reader(); // our main object

And after that, im giving my excel file direction to excel reader object's read function for reading. 


This code reading our all excel and set on our connection object's properties. Excel sheets in $connection->sheets property.That property cells and cells has row and column values. When we reading passing row by row. 

for($i=$startrow;$i<$endrow;$i++) // // we read row to row
	echo $connection->sheets[0]["cells"][$i][$col1]."
"; // so we get [2][3] and [3][3] }

Thats it.

You can watch my video also: