DelphiFAQ Home Search:

Perl script on web server sends Excel file to browser


comments45 comments. Current rating: 2 stars (44 votes). Leave comments and/ or rate it.


I need to have my web site generate an Excel worksheet on the fly (a database export) and send it to the user's webbrowser. How can I do that?


The following assumes that you export a simple sheet containing strings and numbers, no formulas.

In this case, you can generate a CSV file (comma separated values) and set the mime type to applicatioon/octet-stream.

If you perl script is called as /cgi-bin/ then the downloaded file will by default be named (using alternative mime type application/

To suggest a specific file name (other than the script name, use the Content-Disposition header field. This field allows you to provide other information as well, e.g.

- creation-date
- modification-date
- read-date
- size

The size parameter indicates just an approximate size of the file in octets. It does not have to be the exact size. This information can be used by the client software (web browser) to pre-allocate space before attempting to store the file, or to determine whether enough space exists.

For the full syntax, see RFC 2183

# alternative 1:
# sending a file simply as an Excel
print "Content-type: application/\n";
print "Content-Disposition: attachment;filename=users.csv\n\n";

# alternative 2:
# sending a CSV file and suggesting 'users.csv' as the file name
print "Content-type: application/octet-stream\n";
print "Content-Disposition: attachment;filename=users.csv\n\n";

# now dump the data
# all values are enclosed by " in case the 
# strings contain a comma
# this dumps 2 rows with 2 columns each
print '"1","Test, first one"' . "\n";
print '"2","Test, last one"' . "\n";

Content-type: text/html


You are on page 3 of 3, other pages: 1 2 [3]
2020-09-12, 03:42:36
anonymous from Germany  
viagra sildenafil rezeptfrei

[url=]viagra levitra cialis canada[/url]
<a href='>viagra niagra</a>

viagra achat en pharmacie
2020-09-12, 05:00:36
anonymous from Germany  
viagra buying in mexico

[url=]buy generic viagra[/url]
<a href=''>buy generic viagra</a>

2020-09-12, 06:38:17
anonymous from Germany  
purchase viagra outside us

[url=]only today pill viagra[/url]
<a href='</a>

viagra kamagra kaufen
2020-09-12, 12:02:36
anonymous from Germany  
viagras generic

[url=]we use it buy viagra online us[/url]
<a href=''>only here buy viagra online uk</a>

buy viagra in dubai
2020-09-12, 12:34:01
anonymous from Germany  
best buy on viagra

[url=]buy generic viagra[/url]
<a href='>viagra congestione nasale</a>

viagra farmacia italian
2020-09-12, 16:44:02
anonymous from Germany  
pharmacy generic viagra

[url=]viagra prescriptions on line[/url]
<a href=''>italy viagra the counter</a>

no cheap viagra perth
2020-09-12, 20:06:35
anonymous from Germany  
were can u get viagra from

[url=]herbal viagra bestellen[/url]
<a href=''>only today fda approved viagra</a>

cost of 90 viagra pills
2020-09-12, 22:06:27
anonymous from Germany  
caremark utc viagra cost

[url=]cat costa viagra[/url]
<a href='>viagra generic</a>

taken too much viagra
2020-09-12, 22:13:13
anonymous from Germany  
buy viagra in dubai

[url=]viagra generic[/url]
<a href=''>what local stores sell viagra</a>

just try high quality viagra
2020-09-13, 00:37:44
anonymous from Germany  
viagra do i need prescription

[url=]buying viagra on line[/url]
<a href='>viagra muy barato</a>

excel herbal viagra uk
2020-09-13, 04:32:41
anonymous from Germany  
viagra do i need prescription

[url=]buy viagra[/url]
<a href='>viagra levitra cialis canada</a>

viagra online in au pay paypal
2020-09-13, 11:27:57
anonymous from Germany  
viagra where to buy online

[url=]viagra precios comprar[/url]
<a href=''>can i buy 10 viagra pills</a>

venta de viagra en rancagua
2020-09-13, 12:01:43
anonymous from Germany  
3 free viagra pills

[url=]haste viagra post[/url]
<a href=''>buy viagra</a>

how to use liquid viagra
2020-09-13, 14:54:19
anonymous from Germany  
viagra cialis simil

[url=]generic viagra available in us[/url]
<a href=''>buy viagra in mumbai cod</a>

viagra 85 ans
2020-09-13, 15:23:22
anonymous from Germany  
how much does 1 viagra cost

[url=] buy generic viagra online[/url]
<a href=''>use viagra for varicocele</a>

caremark utc viagra cost
You are on page 3 of 3, other pages: 1 2 [3]



NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: