Hello everyone! How do you write a PHP function in codeigniter that lets user download data to an Excel file?


Thank You.

the simplest way is to use fwrite() and give the data with a while() and save the filename with *.xls.
Pay attention to the end of each line to break it wit \t\n, this will separate the lines by tab. Or you can separate each field with \t and save it to *.xls.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.