PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I want to write to a CSV file and then let user click on link to load Excel.
Is there something special that I have to add to file header to prompt the browser to use Excel to open file.
Now it opens with browser as a text file.
http://uk2.php.net/header
As far as i know, you can force the file to be a download but you can't specify how to open the file. The browser will use the default program that is set up to handle that file type on the users computer. You can tell the browser that its a .xls file but you would be lying and then excel would probably complain about unexpected format or something.
mintedjo wrote:As far as i know, you can force the file to be a download but you can't specify how to open the file. The browser will use the default program that is set up to handle that file type on the users computer. You can tell the browser that its a .xls file but you would be lying and then excel would probably complain about unexpected format or something.
Quite correct. There is no way that you can force the opening of a particular application on a client PC, other than another instance of their browser.
Typically, Windows is configured to open files with an extension of CSV using MS Excel when you first install Excel. This can be changed manually at any time by editing the "File Types" settings under "Tools/Folder Options" in Windows Explorer, so it is not universal. It can alos be overridden by other software installations, such as OpenOffice, which allows you to change the default program to OO Calc.