Solved

IE Export to Excel option not working with POSTed data

Posted on 2012-04-11
1
349 Views
Last Modified: 2013-11-19
I have a dynamic html page (created by a cgi script) that I'd like users to be able to right click and use IE's built-in "Export to Microsoft Excel" option.  This works on a static page, but not when any form variables are passed to the script.

The following is a simple example where the username and password are set as hidden variables.  This is not actually what I'm trying to accomplish, but illustrates the problem.

http://www.surveystar.com/test/test_counts.htm

If, instead, the variables are passed in the URL, it works fine (like this link):
http://www.surveystar.com/cgi-local/basicdemo_counts.cgi?username=datastar&password=datastar

It seems the problem is that IE re-loads the page before it exports, dropping any POSTed form variables.  Is there any way around this (other than a custom routine that exports to Excel) -- I'm really looking to allow users to use the built-in function.

Thanks in advance!
0
Comment
Question by:datastarstar
1 Comment
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 37836799
When I have done this sort of thing, I have written out a CSV file on the server and given the client a clickable link.  The CSV file extension is almost universally associated with Excel.  When they click the link, a spreadsheet opens.  This seems to work correctly on all modern versions of Windows and is browser independent.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now