[...] How to create excel file with mysql data using php code « ANIL … Posted in Uncategorized | Tags: connect, data, excel-file, follow-the-below, [...]
You could always explain how to create a real Excel file rather than a simple tab-separated file. Yes, Excel can read tab- or comma-separated value files, as can many applications... giving that file an extension of .xls does not make it an Excel file.
And if you do create a tab-separated file, don't make it such complex code, with all kinds of unnecessary overhead: use PHP's fputcsv() function which does the hard work for you. This has the advantage of escaping quotes and other special characters in your data, which your code doesn't.
If you want to create a real Excel file, which has the benefits of cell formatting, frozen heading rows, filter headings, and all the other features of Excel itself, then it can be done (using less code than your example) with one of the myriad of free PHP libraries such as PHPExcel.
It could be not the ideal solutions but it works very good and it's simple to understand.. I have been more than 2 hours reading other codes and they all included to download api and were more complicated when you use a shared hosting... so, this is short code, easy to understand and use, just copy and paste and it works... anyway when you download the file, Microsft Excel ask you to convert it to a good xls format, you say yes and your file is converted to a legitime excel without any problem.... I think this code is very practical.
Hey all this code sure is great for a simple excel file creation and has worked for me , having said that is there any way we can format the output??? more precisely can i oput in bold text ... please help if if u can ... thank you!!
All this did for me is display in the web page the column names in the database. No excel file and no content from the database other than the headings?
Thank You . i found the first field not appear to modfiy that you must make first $i value in loop is 0 instead of one so it should be like that for ($i = 0; $i < mysql_num_fields($result); $i++)
hi... i want know the ........... how to create .xls file or software .... but step by step means which software or etc and another thing also 1 by 1 ok plz any1 spcly anil plz help yar plz...........
i want to put headers/title in my generated excel report. how can i customize the title/header like centering the title with bold text and underline? thanks in advance.
It is a nice tutorial. I just want to make the excel file stored in a different location other than the project folder . Can you please suggest the code for that also? Thanks in advance
Dude this is great But im getting duplicate values and also im using odbc connection instead of mysql_connect everything is working fine except for the duplicate values can u tell me how can i omit duplicate values thankx..
hay this generates the excel sheet but not showing me any of data..just shows the column name.. i have just copy paste your code...should i have to do modification inside it???
[...] How to create excel file with mysql data using php code « ANIL … Posted in Uncategorized | Tags: connect, data, excel-file, follow-the-below, [...]
ReplyDeleteYou could always explain how to create a real Excel file rather than a simple tab-separated file. Yes, Excel can read tab- or comma-separated value files, as can many applications... giving that file an extension of .xls does not make it an Excel file.
ReplyDeleteAnd if you do create a tab-separated file, don't make it such complex code, with all kinds of unnecessary overhead: use PHP's fputcsv() function which does the hard work for you. This has the advantage of escaping quotes and other special characters in your data, which your code doesn't.
If you want to create a real Excel file, which has the benefits of cell formatting, frozen heading rows, filter headings, and all the other features of Excel itself, then it can be done (using less code than your example) with one of the myriad of free PHP libraries such as PHPExcel.
it is good .but not working online .please suggest something
ReplyDeleteIt could be not the ideal solutions but it works very good and it's simple to understand.. I have been more than 2 hours reading other codes and they all included to download api and were more complicated when you use a shared hosting... so, this is short code, easy to understand and use, just copy and paste and it works... anyway when you download the file, Microsft Excel ask you to convert it to a good xls format, you say yes and your file is converted to a legitime excel without any problem.... I think this code is very practical.
ReplyDeletethanks to Anil..
leo.
Hey all this code sure is great for a simple excel file creation and has worked for me , having said that is there any way we can format the output??? more precisely can i oput in bold text ... please help if if u can ... thank you!!
ReplyDeleteIt is hot cake .helped me very well .Thank you anil
ReplyDeleteplz tell me how to apply bold to text in excelsheet generated by above code.
ReplyDeleteThank you in Advance
i want code for opening existing excel file....code for updating excel file...
ReplyDeletethanx, it work fine!
ReplyDeletehow to do database field name, Excel File title name bold
ReplyDeleteAll this did for me is display in the web page the column names in the database. No excel file and no content from the database other than the headings?
ReplyDeleteWhat am I missing here?
[...] 2)How to create excel file with mysql data using php code [...]
ReplyDeleteThank You . i found the first field not appear to modfiy that you must make first $i value in loop is 0 instead of one so it should be like that for ($i = 0; $i < mysql_num_fields($result); $i++)
ReplyDeletehow to store data in a xml file through php ?
ReplyDeletevery good site
ReplyDeletehi...
ReplyDeletei want know the ...........
how to create .xls file or software ....
but step by step means which software or etc and another thing also 1 by 1 ok
plz any1 spcly anil plz help yar plz...........
i want to put headers/title in my generated excel report. how can i customize the title/header like centering the title with bold text and underline? thanks in advance.
ReplyDeleteIt is a nice tutorial. I just want to make the excel file stored in a different location other than the project folder . Can you please suggest the code for that also?
ReplyDeleteThanks in advance
Dude this is great
ReplyDeleteBut im getting duplicate values and also im using odbc connection instead of mysql_connect
everything is working fine except for the duplicate values can u tell me how can i omit duplicate values thankx..
Can u tell me now how to bold the values
ReplyDeleteWill be much help
Thankx
Thanks for help, really nice post it's useful for me...
ReplyDeletehay this generates the excel sheet but not showing me any of data..just shows the column name..
ReplyDeletei have just copy paste your code...should i have to do modification inside it???
i think it's not going inside the while loop
ReplyDelete