DelphiFAQ Home Search:

Perl script on web server sends Excel file to browser

 

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

Question:

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?

Answer:

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/exportcsv.pl then the downloaded file will by default be named

exportcsv.pl.xls (using alternative mime type application/vnd.ms-excel)

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

Note:
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/vnd.ms-excel\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";


Comments:

You are on page 14 of 16, other pages: 1 2 3 11 12 13 [14] 15 16
2019-07-12, 02:37:45
anonymous from Ukraine  
rating
cheap canadian pharmacy online [url= http://canadianonli...com/]best canadian online pharmacy reviews[/url] legitimate canadian online pharmacy <a href=' http://canadianonli..#'>best canadian online pharmacy reviews</a> canadian online pharmacy reviews http://canadianonli..ydazc.com/
2019-07-12, 14:08:48
anonymous from Ukraine  
rating
generic viagra online canadian pharmacy [url= http://canadianonli../]canadian online pharmacy reviews[/url] online canadian pharmacy <a href=' http://canadianonli..</a> best online canadian pharmacy review http://canadianonli..ydazc.com/
2019-07-13, 10:15:53
anonymous from Ukraine  
rating
best online canadian pharmacy review [url= http://canadianonli...com/]best online canadian pharmacy[/url] canadian online pharmacy viagra <a href=' http://canadianonli..t;canadian online pharmacy viagra</a> viagra online http://canadianonli..ydazc.com/
2019-07-13, 13:07:42
anonymous from Ukraine  
rating
canadian pharmacy online cialis [url= http://canadianonli..com/]brand viagra online canadian pharmacy[/url] visit this page <a href=' http://canadianonli..'>brand viagra online canadian pharmacy</a> canadian online pharmacy cialis http://canadianonli..ydazc.com/
2019-07-13, 14:59:22
anonymous from Ukraine  
rating
best canadian pharmacy online [url= http://canadianonli..]reputable canadian online pharmacy[/url] canadian online pharmacy reviews <a href=' http://canadianonli..#'>best canadian online pharmacy</a> legitimate canadian online pharmacy http://canadianonli..ydazc.com/
2019-07-31, 11:09:06
anonymous  

Do you need a financial help? Are you in any financial crisis or do you need funds to start up your own business? Do you need funds to settle your debt or pay off your bills or start a good business? Do you have a low credit score and you are finding it hard to obtain capital services from local banks and other financial institutes? Here is your chance to obtain a financial services from our company. We offer the following finance to individuals-
*Commercial finance
*Personal finance
*Business finance
*Construction finance
*Business finance And many More:
and many more at 2% interest rate;
Contact Us Via Email:bullsindia187@gmail.com


Keywords:
2019-07-31, 11:09:37
mitwisewrigpowermitwise  

Do you need a financial help? Are you in any financial crisis or do you need funds to start up your own business? Do you need funds to settle your debt or pay off your bills or start a good business? Do you have a low credit score and you are finding it hard to obtain capital services from local banks and other financial institutes? Here is your chance to obtain a financial services from our company. We offer the following finance to individuals-
*Commercial finance
*Personal finance
*Business finance
*Construction finance
*Business finance And many More:
and many more at 2% interest rate;
Contact Us Via Email:bullsindia187@gmail.com
This image was also posted here:
Getting started with perl and mysql
How to install DBD for mysql using CPAN



Keywords:
2019-08-13, 14:14:50
anonymous from Russian Federation  
rating
2019-08-13, 15:16:30
anonymous from Russian Federation  
rating
2019-08-13, 15:51:48
anonymous from Russian Federation  
rating
2019-08-13, 16:08:34
anonymous from Russian Federation  
rating
2019-08-13, 16:45:59
anonymous from Russian Federation  
rating
[url= https://emonipun.tk/..yrel[/url] [url= https://dowinipe.tk/]buy imitrex[/url] [url= https://ihihityvic.g..ropranolol er[/url] [url= https://ipaviqitop.tk/]generic for buspar[/url] [url= https://epuxilizajuh..]bactroban nasal ointment over the counter[/url] [url= https://fabavehoqy.gq/]hydrea 500[/url] [url= https://bycixajubevo..rmin[/url] [url= https://woxofygusara.tk/]how to get antabuse[/url] [url= https://abijuvemuv.t..shwagandha extract benefits[/url] [url= https://yzupohafyb.tk/]buy terramycin[/url] [url= https://rogaloqupywo.tk/]retin a[/url] [url= https://pocomozy.tk/]compazine for headaches[/url] [url= https://egojomaden.t../]coumadin prices[/url] [url= https://ebytehiwylij..q/]indocin 50 mg tablets[/url] [url= https://hikubyti.tk/..orin[/url] [url= https://kegiwidoqe.ml/]buy differin online[/url] [url= https://cuvulavyky.tk/]clomid cost without insurance[/url] [url= https://hacyzogomaba..k/]generic femcare[/url]
2019-08-13, 21:24:12
anonymous from Russian Federation  
rating
[url= https://tobaxiciji.ml/]where can i purchase cialis[/url] [url= https://ozalapexix.t..lbendazole over the counter[/url] [url= https://ysanohacys.m..cephalexin 500 mg[/url] [url= https://anahigarukes.ml/]buy accutane[/url] [url= https://elisysojilar..tk/]alesse birth control generic[/url] [url= https://kekuwokupalu..ednisolone buy[/url] [url= https://ohapafenudoq..zestoretic 10 12.5[/url] [url= https://oxicidyc.tk/]online prescription free zoloft[/url] [url= https://imywabujomip.tk/]buy inderal[/url] [url= https://cosojeqavare.tk/]buy toradol[/url] [url= https://ywezudyqij.t..]albuterol for nebulizer[/url] [url= https://amyjonalaz.m..tracycline purchase online[/url] [url= https://hykisozi.tk/]cialis online legal[/url] [url= https://cohehada.ml/]buy erythromycin[/url] [url= https://urocijogomyt..prednisone sale[/url] [url= https://nipazolu.tk/]zestril 5 mg[/url] [url= https://ehysazud.tk/]tulasi without prescription[/url] [url= https://dyhucyjiqo.t..msam[/url] [url= https://yxixizaver.t..triptyline buy[/url] [url= https://dicoraxuqugo..sone[/url] [url= https://nixyzakyxaxo../]motilium usa[/url] [url= https://qyjodito.tk/..ssor[/url] [url= https://ubydijim.ga/]buy aceon[/url]
2019-08-13, 23:04:12
anonymous from Russian Federation  
rating
[url= https://vezirowuwace.tk/]on line cialis[/url] [url= https://jumaragafi.t../]baclofen pills[/url] [url= https://zoheridafiqi..tk/]altace 2.5 mg[/url] [url= https://jifepasijufe..k/]levitra purchase[/url] [url= https://vehyfyromoso.ml/]buy finpecia[/url] [url= https://myvapyxofigy..furosemide 40mg[/url] [url= https://abefemusuxur..]tadalafil without prescription[/url] [url= https://afazoreracij..l/]generic elimite[/url] [url= https://ewyfegapex.tk/]buy cefixime[/url] [url= https://rosajonyzy.c..]zithromax online[/url] [url= https://raviwogodylu..ga/]cialis tadalafil[/url] [url= https://onyzocuhurug.tk/]buy fml forte[/url] [url= https://gataqivuzyge.tk/]buy clozaril[/url] [url= https://qakovykeji.ga/]mobic 7.5 tablets[/url]
2019-08-13, 23:10:43
anonymous from Russian Federation  
rating
[url= https://hacyzogomaba..care[/url] [url= https://asomehosex.tk/]bactrim ds without prescription[/url] [url= https://efapigehenew.gq/]buy kamagra jelly[/url] [url= https://vukypucagaby..k/]generic florinef[/url] [url= https://uvydotyc.tk/]purim diet[/url] [url= https://ywipojywug.tk/]where can i buy prozac[/url] [url= https://vegylihixyru..ithromycin amoxicillin[/url] [url= https://jumiwota.gq/]kamagra chewable[/url] [url= https://aqasanih.tk/..amethasone decadron[/url] [url= https://walohude.tk/]generic malegra fxt[/url] [url= https://jyrisyzuxu.tk/]buy abilify[/url] [url= https://sixipuwunoly../]nolvadex 20 mg[/url] [url= https://aqonaluvad.tk/]generic malegra fxt[/url] [url= https://usuwywiponox..diclofenac 100 mg[/url] [url= https://adekomuriw.t../]ventolin no prescription[/url] [url= https://necijoqogi.gq/]buy combivent[/url]
You are on page 14 of 16, other pages: 1 2 3 11 12 13 [14] 15 16

 

 

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: