Link to home
Create AccountLog in
Avatar of lword
lword

asked on

Opening .csv file in a browser window.

Hi,

I am using php to download the data from a .csv file. When the user clicks the download button, the .csv file is getting opened as an excell sheet in the browser window. However, the excell's menu and tool bars are not visible, hence the user can't save them to the client machine. Is there any way to make the file menu visible when the excell opens up in the browser window. I am not looking for any vbscript based advices since the page is supposed to be cross-platform and cross browser compatible.

Thanks in advance for prompt responses.

Greetings.
jose.
Avatar of sciwriter
sciwriter

You cannot control how each users system handles a specific file extension, because that depends on how the individual has set the file extensions to be handled by a specific program on each computer.  CSV is not only handled by Excel, but also by other programs.  And if someone doesn't have Excel the browser will not know how to handle it at all.

The only solution in this case it to package the file as another extension.  .ZIP is fairly universally understood by all browsers to be a downloadable and saveable file -- so is .EXE, but these can have viruses.  SO there are only two universal choices -- use ZIP if you want the user to save the file, use .TXT if you want them to view it on line (CSV is just a text file anyway.)  

You can instruct the user to press Alt-S in Excel to Save the file (works without the menu), but there will still be people who do not have excel installed, so that is no universal solution.
Sciwriter is slightly incorrect, Zip is not the only solution.

If you have a PHP or ASP server, there is some server side scripting that can be done to make the browser treat the .csv as a download rather than an excel file.  If you do have one of these servers, let us know and me/someone can post the code.
Sure.... but the topic is HTML !!!   Not Php or ASP.   Stick to the topic, no?  Maybe this should be in PHP?
Avatar of lword

ASKER


We can reasonably assume that the users of this page would have excell environment on their desktops and they would prefer opening the .csv file in excell straight away. Is there any specific html attribute that directs the browser to load the excel application in full screen?

Hope this question remains relevent to the topic since php or asp finally produce html page!

Thanks  for the suggestions.
Cheers.

jose.
ASKER CERTIFIED SOLUTION
Avatar of seb_gibbs
seb_gibbs

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer