Monday, 4 February 2013

3 simple Steps to Create PHP code to Excel SpreadSheets

   As per many request am telling you that this tutorial designed.Spread sheets are simple and easiest sheets which can arrange data in order.Follow below steps for convertion.




                     3 simple Steps to Create PHP code to Excel SpreadSheets 


STEP-1: TYPE OF THE CONTENT 

what type of content its is, it may be pdf or it may be word or excel


        header("Content-Type: application/vnd.ms-excel");

"application/vnd.ms-excel" tells you the content type

STEP-2: ADDING THE DATA

echo "name" ."\t". "ph-no" ."\t". "state"."\n";
echo "siddhu" ."\t". "9533754145" ."\t". "andhra"."\n";

"\t" - gives you tab Space 
"\n"-new line output

name    ph-no       state
siddhu 9533754145 andhra


STEP-3 :DOWNLOAD EXCEL SHEET

header("Content-disposition: attachment; filename=spreadsheet.xls");

data added and header added by writing above lines you can convert php to excel

THANQ
siddhu vydyabhushana.

4 comments: