Skip to main content

Posts

Showing posts with the label php excelsheet

Simply Create Excel Spreadsheets in PHP without using any library

Simply Create Excel Spreadsheets in PHP In PHP , create excel Spreadsheets of database data we only need to set headers. header("Content-Type: application/vnd.ms-excel"); and header("Content-disposition: attachment; filename=city.xls"); The First header we need to set content type ms-excel . The Second header will make file downloadable. when we run this file into browser then browser will ask to download xls file. Example 1 echo 'Name' . "\t" . 'Address' . "\t" . 'Contact' . "\n"; echo 'Coderain' . "\t" . 'Internet' . "\t" . '111111111' . "\n"; Explaination Example 1 will add Name , Address , Contact column into excel as a header of excel file. then you can add data after this. \t = \t is used for end current tab or column and go to the next tab or column. \n = \n is used for go to next Row or Line. Here is the complete example of create excel file of...