Dynamic Excel Reports with ASP
page 1 of 3
Published: 20 Sep 2003
Unedited - Community Contributed
Sometimes it's useful to present data to users in Excel format, so they can easily manipulate the data themselves. In this article, a very simple technique for accomplishing this is demonstrated.
by Steven Smith
Average Rating: 
Views (Total / Last 10 Days): 131736/ 88
Article Contents:


There are many situations in which you may wish to convert table data into an Excel spreadsheet format for the user. There are several methods available for doing this; I will describe in this article one of the simplest ones. It basically tricks the user's browser into thinking the HTML it is downloading is actually an Excel document, and then Excel does the rest of the work by parsing the HTML into a worksheet. Because of the way this works, although this technique is free and easy, it is also very limited in how it can be used. Also, this method only works if the client has Excel 97 or later installed.

If you need to generate Excel documents on the web server in any kind of scalable, robust, or customized fashion, the best tool available is OfficeWriter (formerly ExcelWriter) from SoftArtisans. AspAlliance author Andrew Mooney has written a fairly detailed review of an older version (v4) of ExcelWriter.

In order to create an Excel report dynamically, you must simply create a .asp file with the header of:

   Response.ContentType = "application/vnd.ms-excel"

This informs the browser that the code to follow is Excel formatted, and Netscape or IE will prompt the user to Save or Open the file. When they Open the file, Excel is launched and the report is viewed by Excel. In order for Excel to understand your data, you need only to create an HTML table, which Excel 97 will then convert into its own format. NOTE: This must be the first line of code on the page! (Actually, it just has to be before any other header or HTML info is output to the browser, but put it at the top and it won't cause you problems)

For example, a donut shop wants to track its donuts. It has a report written which dumps the following data:

flavor qty_baked qty_eaten qty_sold price
Boston Crème 24 2 10 0.5
Jelly 24 1 12 0.5
Strawberry Crème 36 1 15 0.5
Chocolate Crème Stick 24 2 6 0.75
Maple Crème Stick 12 1 6 0.75

View Entire Article

User Comments

Title: test   
Name: test
Date: 2012-12-03 2:40:44 AM
Title: Okay   
Name: Nitish
Date: 2012-09-15 1:09:20 AM
This Is not gettable.
Title: Multiple worksheets   
Name: Naveen
Date: 2012-07-18 1:21:21 AM
How to create an excel spreadsheet with multiple worksheets.
Title: fgfdg   
Name: dfgdfg
Date: 2012-04-13 7:26:01 AM
Title: excel file not opening   
Name: madhavi
Date: 2010-10-07 5:54:06 AM
an excel kept as hyperlink in our local intranet is not opening and it is giving an error, what could be the problem?
Title: excel file export method   
Name: rajeev
Date: 2010-09-22 3:16:46 AM
very useful site.
Title: problem with xls file opening   
Name: pop
Date: 2010-08-10 1:38:25 AM
we have some files with xls or xlsx extension. i hope these are corrupted when we are open in ms excel 2003 or 2007 the error is :The file you are trying to open, 'XXX.xls' is in a different format than specified by the file extension. Verify that the file is not ......"
pls mail to me if any url and application to recover data from these file

Title: returns me an empty file   
Name: serhat
Date: 2010-08-06 4:41:30 AM
hey, thanks for the article. It asks me download the excel file but its an empty excel file WITHOUT grids!

anyone help?!

thank you.
Title: Need Help   
Name: Baig
Date: 2010-06-17 5:24:00 AM
When the data is large it takes lot of time to download it. The download happens at around 6-7Kbs after saving the file.Please anyone could help in this matter so that the download happens faster for larger data.
Title: Mr   
Name: Rizwan
Date: 2010-06-03 10:22:54 AM
Title: help needed   
Name: Mani
Date: 2010-04-29 12:00:02 AM
Can anyone give me the complete asp code to insert a data from the textbox into the excel file on button click.
Title: uggs outlet   
Name: uggs outlet
Date: 2010-02-05 7:23:15 PM
This informs the browser that the code to follow is Excel formatted, and Netscape or IE will prompt the user to Save or Open the file. When they Open the file, Excel is launched and the report is viewed by Excel. In order for Excel to understand your data, you need only to create an HTML table, which Excel 97 will then convert into its own format.
Title: Dynamic Excel -2007- Reports with ASP   
Name: Rono
Date: 2010-02-04 8:23:23 AM
Response.ContentType = "application/vnd.ms-excel" works great to copy Reports to Excel 2003, but I'm having trouble copying to Excel 2007 (.xlsx) with the following: Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" Any ideas? Thanks!
Title: sale uggs   
Name: sale uggs
Date: 2010-01-07 4:13:59 AM
Compared with any other season of the year, winter is a time to be inside, http://www.saleuggs.net sale uggs and especially around the savory smells of a kitchen in full use. Yes, it's cold outside, and we may need extra calories to keep warm. The reason is: is warming up! Nothing is more satisfying in a fresh cold day than a hearty bowl of hot soup. The idea of your oven space and stovetop burners become more active in winter, an idea consistent with this focus on internal heat and we encourage you to think of winter as a time to celebrate the warm food. At World's healthiest Foods, we have a lot of stovetop steaming and poaching, http://www.saleuggs.net uggs outlet but winter is the time when you might want to go more often for baking and cooking in our oven-based recipes. These recipes will pull you up for longer to the slow heat in the oven.
Title: unicode problem   
Name: ameneh
Date: 2009-12-12 4:40:03 AM
this site is in persian lang. but i dont know how can i fix that.
Title: Help   
Name: Kailas Joshi
Date: 2009-12-10 6:03:07 AM
Could you please tell me how to export images in the html tables to the excell sheet.the excell sheet gives a blank space where the image is present.

Pl reply to jokail70@rediffmail.com

Title: Excel Reports with ASP   
Name: sowmya
Date: 2009-11-06 6:46:03 AM
the information was very useful.
Title: Excel Reports with ASP   
Name: brianj
Date: 2009-10-14 1:42:52 PM
Not what I was looking for, a site had data in .asp file and recommended saving as .xls when downloading.
Title: Very Useful   
Name: Shiva
Date: 2009-10-03 2:45:46 AM
the information was very useful.
Title: Dynamic Excel Generation   
Name: Dave
Date: 2009-09-14 4:29:15 PM
I've got the spreadsheet opened but I cannot perform any calculations on the cells. ie summing up a column. Can you explain why?
Title: Dynamic Excel generation   
Name: Excel from ASp
Date: 2009-08-27 8:53:51 AM
Iam generating the Excel using the above said command from ASP.In The Generated Excel the Cells are with no border.only the Cells with data are having the border.In order to have the border for every cell what i need to do.Please advise me.
Title: easy read/write excel from .net   
Name: filip
Date: 2009-08-19 7:14:39 PM

for easy working with Excel from ASP (or C# or VB) try using GemBox.Spreadsheet. It's component that is very fast and easy to use.
Title: asp vb - get data from sever and submit response.redirect to web service server   
Name: mr zack
Date: 2008-11-10 5:00:53 AM
Dear senior programmer,

I need some help from u,

I already create 1 form to send through the web service server. Now what happen to me is i only can insert data throught my server. What i want to do now is if i click insert from the form the data can automatically go to web service server. i try to do but still cannot running.
This is code what i try to create:
Dim rs, conn, sql, G_name, G_desc, objCmd

SET objCmd.ActiveConnection = objConn
set Conn = server.createobject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.recordset")
sql = "SELECT custG_name, cust_Gdesc FROM cr_clientG"

rs.Open sql

Do While Not rs.EOF
G_name = rs.Fields("custG_name").value
custG_name = rs.Fields"custG_name").value 'getting a value from a recordset
rs.Close sql
set rs = nothing
Server.Transfer ("http://www.etracker.cc/mayflower/Default.aspx?ccsForm=cr_clientG1")

may someone help me! Please email me to zahir@mayflower.com.my....
Title: how to use crystal reports in asp.net   
Name: bhanu
Date: 2008-10-22 2:21:47 AM
i want create bar chart dynamically use the datatable creted at runtime..........
Title: Export data to Excel from ASP   
Name: Juan Carlos
Date: 2008-10-15 12:02:39 PM
Estimado : Sripriya Krishnamoorthy
Usa una función random para darle un nombre diferente en cada llamada a la pagina que genera el ExCel.

Saludos desde Peru
Title: Export data to Excel from ASP   
Name: Sripriya Krishnamoorthy
Date: 2008-09-19 4:01:24 AM
Hi, I am using the response.contenttype="application/vnd.ms-excel" to export data to excel from an asp page. My problem is that for all the options there is a single asp page from which the excel is opened. So when we try to open the excel simultaneously or again, we get an error Could not open .../

Could anyone help to resolve this issue if you are aware of this?

Thanks in advance.
Title: Mr   
Name: Naresh kumar
Date: 2008-09-11 3:37:03 AM
Iam Not able to export to excle using this
Title: problem exporting to various worksheets   
Name: akhtar
Date: 2008-08-07 9:40:33 AM
I am trying to display my database which was created in sql server, into one excel workbook but each field to display in a different worksheet using ASP. Is this even possible?
If yes can you please give me some sort of example code thanks
PLEASE MAIL ME : rakhtar541@btinternet.com
Title: Some Issue Exporting to excel   
Name: BVVPrasad
Date: 2008-07-20 5:34:08 AM

This is very good. By using this i was able to get the date in excel from html.

But one thing i have an issue with this.
I was unable to open the exported excel file in MS Excel 2007
I want to export to MS Excel 2007

Please help me on this

If any body know, Please reply to my mail id:venkatavaraprasad.batta@gmail.com

Title: Some issue   
Name: BVVPrasad
Date: 2008-07-16 2:30:47 AM

This is very good. By using this i was able to get the date in excel from html.

But one thing i have an issue with this.
When i click on export button on my page it is asking open or save dialog box. When i try to open this I am getting a error message dilogbox.

It specifies that "The file you are trying to open 'xxx.xls', is in a different format than specified by the file extension." How to disallow thid dilog box.

Please help me on this

Title: get field name only once   
Name: brunda
Date: 2008-07-04 6:19:43 AM
hi, can i know how to get the single value
suppose search element according to name, then same person has bought diff commodities, now name should be displayed only onces, and other details below the name .name should not repeat.

Please help me out.
Title: generating excel report in ASP   
Name: Abhishek Sinha
Date: 2008-06-20 2:35:23 AM
Can anyone please tell me how to format excel sheet.

I'm populating a cell with few french characters without any formatting, but after generating the excel sheet french characters are getting replaced with some other characters.

Please help me out.

mailme @ : abhisheka.sinha@gmail.com
Title: Good   
Name: vishal
Date: 2008-06-11 8:33:09 AM
i like your artical it is very helpful for me but i want it in asp.net with vb and u provided it in asp.net with c#. i tryed to convert this code but i m not get success. so please kindly give that code if any one have.
thanks in advance....
my email is vishal_web@rediffmail.com
Title: Encoding problem   
Name: Mady
Date: 2008-05-29 12:52:44 PM
Hi there,

Nice Article.
I am facing problem with Encoding. I am using German language.I wrote Response.charset="UTF-8" but still doesnt work.

Any help would be appreciated.

Title: Line Feed   
Name: Sudheer
Date: 2008-05-13 10:59:42 AM
If you want to add a line break when generating Excel sheet, replace Char(10) or Char(13) with

"br style="mso-data-placement:same-cell;" /"

Note: add opening and closing tags when you use it
Title: Multiple worksheet   
Name: WebProg
Date: 2008-05-05 8:00:47 AM
I need to open from asp multiple excel sheets (number of sheets different depending on output in asp). anyone has some code to share? thanks
Title: Export into the Excel Sheet   
Name: Naveen
Date: 2008-04-25 1:32:30 AM
i have used the method u have been described above but it appearing blank
Title: Excel Cell Formatting Problem   
Name: Srinivas Alwala
Date: 2008-04-21 10:29:43 AM

I have used Response.ContentType = "application/vnd.ms-excel" to export data into excel using asp+sql.

Sometimes the data in excel displays with a symbol at top left corner of the cell while clicking on the cell and moving cursor to the sybmol it says the cell contains data string with only 2 digits for date field. This special symbol is not displaying in all cells of that date column.

Now, I need to remove this kind of special symbol using asp.

Pls help.


Srinivas Alwala
Title: embed image to excel from asp   
Name: Ashwini
Date: 2008-04-21 5:48:50 AM
I want to embed image in excel whenever i am downloading a asp file to Excel.
Title: Tool Bar of My Excel   
Name: Shweta Modi
Date: 2008-04-21 3:33:13 AM
I have few comments. As i have used the code i cannot find the toolbar above the excel page. I am working on Classic ASP application. Can you help me out.

Contact: Shweta8231@gmail.com
Title: Code isn't working in case of Oracle as backend   
Name: Raj
Date: 2008-04-17 1:41:09 AM
This code is working for Access but this isn't working for Oracle as Oracle is not supporting Response.ContentType = "application/vnd.ms-excel"

If any one could help me incoporate the same logic for Oracle(9i) it will be great.
Title: Formatting   
Name: Anupam Baburajan
Date: 2008-04-04 7:29:38 AM
How can I format cells? I'm populating a cell with a character string, but if that string (i.e. 000123) is to be numeric, then it displays 123. Result should be 000123. How
can i solve this problem. Please reply me at anupam@programmer.net
Thanks and Regards,
Title: Question to j0ksta   
Name: Giri
Date: 2008-04-02 7:23:17 AM
I saw the following comments, the XML protection is not working with normal data. can you please let me know how to enable the protection in the excel file.

Title: j0ksta
Date: 1/27/2006 2:24:41 PM
After much searching, I finally found a way to manipulate the sheet name and protect the sheet. I replaced all greater than and less than signs with brackets so it would display correctly.

First, you must change your [html] tag to the following:
[html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel"]

Second, use xml code to manipulate these like so:

[x:Name]Worksheet Name[/x:Name]

That's It! Remember to replace "[" with "<" and "]" with ">"
Title: Issue with Excel page not popping up automatically.   
Name: Akhil Vig
Date: 2008-03-05 9:46:40 AM
in my application iam trying to open an excel file(dynamically) when a button is clicked.
iam opening file in a new window.
while running application new opening of new ie is done but before opening of file it is closing,
if i hold ctrl key its working fine.
is there any alternative to open a file with out holding ctrl key. The application is hosted on windows 2003 Server (Standard edition) can anyone help, my email ID is akhil_vig@rediffmail.com
Title: Spot On do you have one for PDF   
Name: GTNash
Date: 2008-02-26 7:51:11 AM
Nice, very nice and so much less work, and less confusing then Microsofts instructions. You don't by any chance have a version that does something similar for PDF??
Title: SaveAs Type in Excel Report   
Name: Millan
Date: 2008-02-12 2:39:11 AM
I am working in ASP and I have a situation like I put a hyplink in asp page where on clicking it, It will open a new excel page by using " Response.ContentType = "application/vnd.ms-excel" "
Now when I say SaveAs it saves as in html format and I want to save it by default in xls format. Any idea?

Title: GOOD   
Date: 2008-02-06 6:02:27 AM
Title: Mrs   
Name: Kalpana Srikant
Date: 2008-01-26 5:31:18 AM
Nice example. But I need to create an excel file with multiple sheets from asp. Can you anybody suggest me a method for that
Title: How to create multiple Excel sheets using Asp.   
Name: HQ
Date: 2008-01-11 10:52:04 AM
I am generating a report using asp and data is displaying in Excel using
Response.ContentType = "application/vnd.ms-excel"
I have more then 65535 records, how can I display remaining on new sheet using Asp.
Please let me know : urfriend_6000@yahoo.co.uk
Thanks in Advance
Title: how to generate excel sheet with image without using path!!   
Name: Avinash
Date: 2007-12-17 1:44:54 AM
m using code:
Response.ContentType = "application/vnd.ms-excel"
for export image and convert asp page to excel But i want to use code those insert image without using path of image.
show plz provide code.those not require path of image.
Title: view   
Name: lakshmi
Date: 2007-12-10 8:13:30 AM
actuall i want the code to generate report in .xls .I dint get proper details by dis article
Title: Need to export asp table data to excel   
Name: Ali
Date: 2007-11-24 1:21:34 AM
Hi ,
I need to export the table data when i click on image button.I need java scrit function which i can call easily onclick .is there any way ?
Title: multiple worksheets   
Name: Chanyut
Date: 2007-11-22 12:29:10 AM
Really nice artical!
but i had some problem about this.
How to add multiple worksheets to an excel.Anybody can be suggestion me plz let me know: pitbullgroup@hotmail.com
Title: This works..but I use Crystal Reports for Excel saves   
Name: C. Youngblood
Date: 2007-11-12 1:50:21 PM
I have one question. When I redirect my code to the Crystal Reports the login and password work fine. But, if I have a subreport inside the report it prompts me for a password. Where do I pass the subreport login and password? I have spent over two days researching this. Thanks in advance.
Here is my code:
Response.Redirect (reports/24HourSummary_Shift.rpt?user0=XXXXXX&password0=XXXXXXX”)
Title: Excellent   
Name: Noman
Date: 2007-10-28 6:09:28 PM
This is an excellent article.
and helped me alot.
but the only problem i am facing after using this code, the page is not exactly appearing as it is appearing in web pae.
is it due to nested use of tables?

and one more thing, if we change the above block of code, with this block of code then page will open in excel instead of in web page.

Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=Enquiry_List.xls"
Title: Data transfer   
Name: vaibhav
Date: 2007-10-27 4:03:06 AM
Dear All,

How to transfer excel cell data from one excel file to another excel file using ASP.
Title: Page Not Found Error Showing while generating report   
Name: Shiva
Date: 2007-10-15 8:24:29 AM
I m generating an excel report from ASP page. Often it shows "Page not found" error. But after refreshing twice or thrice, it shows the report properly.

I used the header as below
<% Response.CacheControl = "no-cache" %>>
<% Response.AddHeader "Pragma", "no-cache" %>
<% Response.Expires = -1 %>

The article on http://support.microsoft.com/kb/323308/
says that "Internet Explorer file downloads over SSL do not work with the cache control headers"

so I tried removing the header also, but still its throwing the same error.

Can you help me please.
Title: data retreave from html view source   
Name: srinivasulu
Date: 2007-09-12 1:30:51 PM
i want get the data from html view source of any page
Title: better than this   
Name: nitin
Date: 2007-09-12 11:19:19 AM
i also write code for excel. just 10 lines
if anyone want mail me
Title: select a particular sheet for writing   
Name: Sundareshwar
Date: 2007-08-31 5:05:48 AM
How to give different names to different sheets and select a particular sheet for writing in excel from C# ASP.Net. Please help me and respond to me asap at sundareshwar.j@gmail.com.

Thank You,
Title: Good ... but   
Name: Ree4u
Date: 2007-08-20 2:50:48 AM
Great code..


It doesn't work in safari..it save a fle .asp format is there any solution for that.....

Title: export to word   
Name: Ramesh
Date: 2007-07-25 12:11:37 PM
Hi I have a ASP page with table and I need to Export the data's to ms word woth out table border.Here I have mentioned the Table border is 0.But Still I am facing the same problem can any one help me.
Title: Have User provide feedback to spreadsheet   
Name: K
Date: 2007-07-05 6:33:30 PM
I have a table that I would like to post on a web page. And have Users provide feedback if there are errors or additional information. What would be the easiest way to do that? kelan@lycos.com
Title: question plz help me   
Name: solanki
Date: 2007-06-28 7:49:10 AM
Your artical is nice.I want to generate dynamic chart through asp with mysql database..i have data in execel file..or tell me other way !!!plz help me send me code..its very urgent solankiaks@gmail.com..

thanks in advance
Title: problem with content type   
Name: Shashank Gaitonde
Date: 2007-06-15 4:58:41 AM
I made showed 2 tables in an HTML page using ASP. When I generate Excel file using above method the files displays tables correctly in Excel XP but same file when opened in Excel 97, does not display tables correctly. Can anybody help ?
Title: generating report from asp.net to excel   
Date: 2007-06-08 8:11:36 AM
i am facing a lot of problem while try to genetare a report in excelsheet.i want to genetate a report in ExcelSheet.i am working in the asp.net,c# platform.plz help me if possible.i want to genetate a report in ExcelSheet.if plssible help me with simple example as early as possible.
Title: perfect   
Name: Comert AYBEY
Date: 2007-06-05 4:57:42 PM
Title: Save without Save open dialog box   
Name: Rajeev Maithani
Date: 2007-05-31 4:52:58 AM
Can the Excel be saved directly to the location hardcoded in the code without prompting the user to save or open the Excel.
Title: help me   
Name: garima gupta
Date: 2007-05-30 10:53:08 AM
Is there a size limit when generating an excel document out of a web page using Response.ContentType = "application/vnd.ms-excel"? I'm only bringing back about 15,000 records and my generated excel document is coming back showing the html code, and it's missing the first few lines.
Title: datagrid to excel   
Name: Ankit
Date: 2007-04-27 4:05:31 PM
datagrid to excel using the contenttype works fine on my local machine , but when I deployed it on the server , its downloading the aspx.page itself and giving error saying it cnat download that page ... Any suggestions ?
Title: excel to access db   
Name: guru
Date: 2007-04-26 7:33:32 AM
i need a code to insert excel columns into an access database. pls help me ----> gaguru@gmail.com
Title: not satisfied   
Name: rohit
Date: 2007-04-03 6:24:42 AM
i have used this but it is saving the .asp file on client,but i want to save that data as a excel file on client.Pls help me
Title: JAVA   
Date: 2007-03-29 6:23:56 AM
Title: asp   
Name: as your wish
Date: 2007-03-26 5:44:15 AM
good. keep it up
Title: question   
Name: sandeep
Date: 2007-02-26 2:01:21 AM
i have a html form in which there are many title for each excelsheet. as user click on one title a Excel file is open & make change in it & again submit it to server
plz help how to code
Title: How to export images, CSS from HTML report to Excel?   
Name: Shyam S Pandey
Date: 2007-02-03 11:58:25 AM
Hi there!

Would you please provide some hint on how to export images, css into excel sheet from HTML report? Any hint would be much appreciated.

With Thanks!
Shyam S Pandey
Title: question   
Name: indu
Date: 2007-01-30 8:29:48 PM
good.I am importing a excel file using C# the datas in excel file should be loaded in three tables(ie MS SQL server 2000 database)
Title: IT Consultant   
Name: David H
Date: 2007-01-11 8:05:23 PM
Great tip - works a treat
Title: Excel Data retreive from Access Database and display in asp   
Name: Nadeem
Date: 2006-12-18 8:00:20 AM
Title: code in C# asp.net   
Name: parag
Date: 2006-11-29 5:52:07 AM
can u give code for the same in asp.net using c#
Title: Excel Importing   
Name: Bhargavi
Date: 2006-11-27 12:47:18 AM
nice one
in my application iam trying to open an excel file(dynamically) when a button is clicked.
iam opening file in a new window.
while running application new opening of new ie is done but before opening of file it is closing,
if i hold ctrl key its working fine.
is there any alternative to open a file with out holding ctrl key.
Title: I had one issue   
Name: Rathi
Date: 2006-11-21 9:45:49 PM
I want to open an existing excel workbook and i want to work on that book is it possible in classic ASP
Title: Nice   
Name: Rupesh
Date: 2006-11-06 5:20:19 AM
Thank you
Title: dotnet dev   
Name: john
Date: 2006-10-19 12:06:37 AM
HI it was really good article i just have one doubt ho can i generate multiple excel sheet if data to be exported is greater than 65500 like that
Title: Save excel file generated by asp to server   
Name: amar
Date: 2006-10-11 12:58:21 PM
hi i have used response.contenttype to create excel file from database then i need to save it to server as soon as it create file
Title: transpose   
Name: bhaks
Date: 2006-10-05 5:20:35 PM
can any one tell me how to go abt transposing the excel sheet generated thru the above asp code
Title: Excel-lent   
Name: David
Date: 2006-10-02 1:36:32 PM
And some code for making the file name. Response.AddHeader "content-disposition", "attachment; filename="YourFileName.xls"
Title: Question   
Name: Piyush Sharma
Date: 2006-09-20 1:52:26 AM
Thanks Steven,
How can i export data from textboxes to excelsheet in some predefined columns ?
Title: SE Trainee   
Name: Diya
Date: 2006-09-14 4:47:57 AM

is it possible to export report to excel from an asp page that contains .bmp files without creating another asp page
Title: Software Engineer   
Name: Debbie Wills
Date: 2006-08-29 5:44:12 AM
It Works!!!
I love you, you sweet sweet guru.

Title: question   
Name: Raj Sherawat
Date: 2006-08-17 8:39:35 AM
what is defirence vb & vb.net and this program software???
Title: same cell formatting   
Name: uhg
Date: 2006-08-09 12:38:57 PM
Title: soft return??? !!!   
Name: uga
Date: 2006-08-09 12:34:16 PM
this wont take my code!!!!!!!!
Title: question   
Name: puviyarasan
Date: 2006-08-09 9:00:03 AM
how to handle the multiple worksheets
Title: How multiple excel sheet creation in asp   
Name: velmurugan
Date: 2006-08-07 1:59:38 AM
How to create one excel file in multiple excel sheet creation using asp
Title: excle report   
Name: suresh
Date: 2006-08-04 7:41:46 AM
i want how to generate execle report in vb.net,with basics.
how the execel sheet can call in vb.net .
how do we write the code in execle sheet like
Title: Strange Problem   
Name: Anup
Date: 2006-07-20 5:37:35 AM
Can anybody help:

when I set value for any cell like :
wSheet.Cells[m_rowIndex ,4].Value = "10020D300"
it appears as 1.002E+304 on excel-sheet.
(Internally it may be converting it to exponential value or so..)

Please let me know if you know solution to this.
Title: Ms   
Name: Priya
Date: 2006-07-06 2:20:09 AM
good work
Title: consolidating many wksheets   
Name: anju
Date: 2006-06-30 6:59:54 AM
Found your article very impressive !!
So just thought of shooting all my doubts here only.

I am generating excel sheets on web browser with the help of ASP code. but now, i want all the sheets to be consolidated into one workbook, through ASP only.Can u pls tell me how can i do that? Also, how can i name this workbook?
Can't we extract a single worksheet which has rows > 65500 (i.e. excel limit)? if yes, then how?

Thanks a lot in advance.

Please answer my query ASAP.

Title: This sample doesn't import into an Access DB   
Name: Woo Raphael
Date: 2006-06-27 12:40:34 PM
The sample excel file you get from the above doesn't import directly into an Access DB. There are errors.
Title: F A I Z   
Name: Mohammad Faiz
Date: 2006-06-26 1:36:20 AM
Good Stuff
Title: How to export to excel... continuation to Sheet2   
Name: MLSL
Date: 2006-06-08 4:01:09 AM
i have more than 66,000 records and need to export to excel... Currently excel can only take 65,536 records only. How to automatically go to Sheet2? thanks in advance.
Title: Excel Import   
Name: vineeta
Date: 2006-06-08 2:45:38 AM
I have to read the data from excel file to my vaspread. Data is in Thai font. My system support Thai Language but the data comes in the vaspread in quetion marks (????). While enter the data from keyboard into vaspread it takes in Thai font only.
The problem comes only when it copy the data from Excel to vaspread.
Title: How To Insert Cell Comment When You Are Creating an Excel File With an Active Server Pages   
Name: Madhu
Date: 2006-06-07 4:29:55 AM
How To Insert Cell Comment When You Are Creating an Excel File With an Active Server Pages
Title: How to Insert Comment to a cell   
Name: Madhu
Date: 2006-06-07 1:51:11 AM
A very Good article, thanks Mr. Steven.
I want to insert comment for a cell.
any help will be appriciated...

thanks in advance
Title: Software Engineer   
Name: Sarvoday
Date: 2006-06-04 6:03:43 PM
Good work Bro..
Title: singh   
Name: bipin
Date: 2006-05-29 2:57:39 AM
insert picture into excel file
Title: problem   
Name: harshal
Date: 2006-05-26 8:36:25 AM
HI i am working with c# asp.net
when i create the table at runtime in postback then my excel sheet is empty but when i doesn't use postback
then it works ok
but i want postback because the table content changes at runtime
Title: Thanks a lot   
Name: Kabou abdellah
Date: 2006-05-10 10:34:59 AM
Thanks a lot for this code I was looking for a kind, a long ago.
It's very quick an dsimple to use with mysql
Title: Default save as XLS format   
Name: V V Kiran Kumar
Date: 2006-05-03 3:17:03 AM
I am working in .net and I have a situation like I put a hyplink in aspx page where on clicking it, It will open a new excel page by using " Response.ContentType = "application/vnd.ms-excel" "
Now when I say SaveAs it saves as in html format and I want to save it by default in xls format. Any clue?
Title: Gipl   
Name: Ganesh lal bairwa
Date: 2006-05-02 9:58:33 AM
it is really a good programming practice.
i liked it very much.
thanks for provide it free
Title: question   
Name: jatin
Date: 2006-04-05 5:36:59 PM
I need an asp code to calculate the result of test which I have made in asp and the calculation page will not see byusers .
Can anyone help me in this please I need this thing very soon .
Title: Exporting Datafrom SQL Server   
Name: Lisa
Date: 2006-03-29 12:08:59 PM
This code is superb & I have got it working no problems on my site using access. The only trouble I have is that I am also using a Microsoft Server SQL database for another site & I don't know how to get it to look at that instead of an Access one. Any tips?
Thanks for your help.
Title: Good   
Name: Amandeep
Date: 2006-03-18 9:20:03 AM
Title: Zindani   
Name: Raveesh
Date: 2006-03-16 1:33:42 AM

This Article is very very useful for me. but i just want to know if there is any possiblity to present the data in pivot table format (ms Excel pivot table) and another thing is i dont want user to make changes in some of the selected cells.

tell me the appropriate solution.

Title: Question   
Name: Shaji John
Date: 2006-03-10 6:11:08 AM
But how do i add a new sheet?? I want data in two sheets.
Title: export swf in excel   
Name: neel
Date: 2006-03-03 1:42:44 AM

I already generate chart with asp + flash now i want to export data + chart into excel or word
if anyone know how?
becuse when i export it swf some portion is exported in excel but not full graph
can anyone help me
Title: multiple worksheets   
Name: devi
Date: 2006-03-03 1:10:01 AM
In asp how to create multiple sheets in a single workbook with code.reply immediately
Title: Question to j0ksta   
Name: Vyas
Date: 2006-03-01 2:39:55 AM
I saw the following aricle of yours, but it not working well with normal datas, plase tell me whenther the code can only work with XML data or will it work with table format?

Title: j0ksta
Date: 1/27/2006 2:24:41 PM
After much searching, I finally found a way to manipulate the sheet name and protect the sheet. I replaced all greater than and less than signs with brackets so it would display correctly.

First, you must change your [html] tag to the following:
[html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel"]

Second, use xml code to manipulate these like so:

[x:Name]Worksheet Name[/x:Name]

That's It! Remember to replace "[" with "<" and "]" with ">"
Title: covert an .aspx file in .PDF format   
Name: Ajit
Date: 2006-02-21 11:38:58 PM
can I generate covert an .aspx file in .PDF format without using Crystal Report As my Server Doesn't support Crystal Report....
Title: Multiple worksheets   
Name: Vyas
Date: 2006-02-13 5:12:33 AM
How to add multiple worksheets to an excel
Title: Just what I was looking for   
Name: WebDever
Date: 2006-02-08 5:45:43 PM
Thank you very much for the informative article. It's exactly what I was looking for to implement a company tool.
Title: Mr.   
Name: Thangadurai.P
Date: 2006-02-06 2:14:17 AM
Nice code.
Title: Dynamically naming the sheets in excel   
Name: Lakshmi Kumar Manyam
Date: 2006-01-30 4:14:00 AM
Hi Frns,

This article is very nice and provided a lot of information.

My problem is how to create a excel sheet names dynamically. In the below queries and responses i just found how to name a single excel sheet.

My query is . I have a records of 2 lakhs retrieved from database, all these are to be dumped to excel file. Since a sheet in excel file can only support 65,000 records, we need to divide the 2 lakhs records into 3 sheets. Now i want to name the excel sheets dynamically.

Can anyone help on this. All this is done in ASP.
Title: j0ksta   
Date: 2006-01-27 2:24:41 PM
After much searching, I finally found a way to manipulate the sheet name and protect the sheet. I replaced all greater than and less than signs with brackets so it would display correctly.

First, you must change your [html] tag to the following:
[html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel"]

Second, use xml code to manipulate these like so:

[x:Name]Worksheet Name[/x:Name]

That's It! Remember to replace "[" with "<" and "]" with ">"
Title: Excel to asp or html   
Name: Raj
Date: 2006-01-27 12:51:52 PM
Hi i have an Excel File(.csv). How can i convert it to html with proper formatting....i am able to convert but the data comes in the same line.. without considering cell position of excel.i need to display it as it is displayed in the excel file. with proper indentation
Title: Dynamic Excel Reports with ASP   
Name: mia
Date: 2006-01-26 1:42:30 PM
This works great when the sql doesn't have any conditions with parameters being passed. What happens when it needs a condition with parameters passed in the sql?

Please advise
Title: Tewari   
Name: Priya
Date: 2006-01-23 11:40:11 PM

No doubt this code is very useful but can you tell me, what should I do to access these cell data to my asp page back.
I want to display IRR on asp page.

Title: How to export dynamic HTML table in asp page to excel   
Name: Alok
Date: 2006-01-19 7:03:34 AM
Hii Smith

Nice Article, but i am having differnt problem. I am having an asp page, which having two HTML tables.
First one to show some controls like text box, radio buttons, dropdown list one check box to export data in excel and a submit button.
So depend upon these controls data is showing in a Table below, so i have to export that data as it is showing in Excel
How i do this ?

waiting for ur reply
email : alok@scarlettech.com
Title: How to Convert Asp.net Page content to excel   
Name: mitul shah
Date: 2006-01-07 4:37:22 AM
hello friends, can anyone help me for the following...

i have one asp.net page which contains tables with textbox controls and labels, now i want to convert this page to excel with well formatted out put can anyone help me how to convert it. please give me reply , i need it urgently..
Title: i m exprience holder   
Name: Vishal Patel
Date: 2005-12-28 2:14:44 AM
Hi This is Vishal Patel And I Have Good Experience For the Asp site but now i am looking for a newone and hard scripts for asp so could you please send me like that one
Title: Can u Solve   
Name: Kamal
Date: 2005-12-27 5:57:59 AM
HI I'm New in ASP, can u giv me some basic notes?
My e-mail address is kamal_muhuri@hotmail.com
Title: Shanty   
Name: Tapan
Date: 2005-12-23 6:04:33 AM
I have 2 tables in one ASP page. This code saves only the first table that is the heading but no data is exporting into excel.
I can not understand where to wite the contenttype code.
Plz assist me.
Title: Very Good   
Name: Piyush Aiya
Date: 2005-12-19 8:53:51 AM
You have done an excellent thing in a short code.. Keep it up!!!.. best luck

Title: Problem exporting Crystal Reports to Excel & Word on some PCs   
Name: Anand Ajgaonkar
Date: 2005-12-16 5:46:43 AM
Hi great article!! I am having a unique problem. I am able to export Crystal Reports to Word and excel, however the report opens only on some machines (Office 2000) while on the others the window simply closes after sometime. My server does not have office installed on it.

Is there any solution to this problem?
Title: pab   
Name: pabmohan
Date: 2005-12-09 5:16:31 AM
I need some help, the issue is that in my page I have a option to output in excel format, sometimes a pop up comes to save open or cancel and some times the this pop up does not come, but the main issue is that the excel hangs when the data is long, I found that when the file is of around 3mb the file takes about 20-30 minutes.
Waiting for a response.
my e-mail address is pab_mohan@yahoo.co.in
Title: exporting report to excel/pdf in asp.net   
Name: Rohit daga
Date: 2005-12-08 12:05:38 AM
plez can any one tell me to how to export crystal report into excel or pdf using crystal reports in asp.net
Title: Fomatting   
Name: Asheesh S Parihar
Date: 2005-12-03 4:24:29 AM
How can I format cells? I'm populating a cell with a character string, but if that string (i.e. 000123) is to be numeric, then it displays 123. Result should be 000123. How
can i solve this problem. Please reply me at asheesh@nagarro.com
Thanks and Regards,
Title: Jain   
Name: Ashish
Date: 2005-11-30 7:18:26 AM
Hi Steve,
I am facing a problem, i have a web page containing around 20 datagrids and i want that each grid is populated in a single excel file(may be in multiple sheets or in a single sheet)
I have a solution if i want to populate a single datagrid but for multiple i am unable to sort it out.
Is there any solution to this problem?If there is solution then please mail me at my email as written in url field.
Ashish jain
Title: Question SQL Server   
Name: BSL
Date: 2005-11-22 11:21:27 PM
can anyone tell me how can i insert data of excel sheet into sql server using macro
Title: open Excel & read worksheet   
Name: Devesh
Date: 2005-11-12 2:15:25 AM
Hi We required help to open excel file and read sheets with in perticuler excel file we are uisng excel.application but it showing error System.Runtime.InteropServices server fails what can we do to open file and read every sheet

Plz. we are waiting to result if posible to help us
Title: Server.CreateObject failed while checking   
Name: Unni
Date: 2005-11-11 5:10:53 AM
When I try to create a excel file through ASP then the the error occures.

Error Type:
Server object, ASP 0178 (0x80070005)
The call to Server.CreateObject failed while checking permissions. Access is denied to this object.

Title: Very Helpful   
Name: Piyush Sharma - Pune
Date: 2005-11-03 6:27:25 AM
I found this article very helpful and used it in one of my ASP application. Its working.

Title: Great one   
Name: Ajaya Ghosh. S
Date: 2005-10-05 3:57:22 AM
Dear Steven Smith
Helpful and very good artilce Thanks You
Ajaya Ghosh .S
Title: question   
Name: bala
Date: 2005-10-04 1:53:46 AM
how to open a pdf file in asp...i need coding for this
Title: DGUY   
Name: DGUY
Date: 2005-09-28 5:48:15 AM

Once excel report is created, how can one implement worksheet-protection to prevent it from being edited? Can anyone please give sample lines of code? Thanks!
Title: Excel to PDF Export   
Name: Naags
Date: 2005-09-24 9:13:47 AM
Can we use the same method for creating PDF Files??
If yes then how?
Title: Deploy Excel in server for ASP.Net   
Name: Suardi
Date: 2005-09-22 2:34:27 AM
We already develop application to extract the data into excel by using excel template. But we have problem, since we should install microsoft excel in server first.

Do you have another idea, how to deploy in production server without intall microsoft excel (just using excel DLL) ?

thks very much for your reply
Title: question file name   
Name: No name
Date: 2005-09-21 11:18:40 AM
Hi all when i'm trying to save the file and the file name contains multiple dots like 2005.12.2.xls
then is adding a [1] before first dot. Any workaround ?
Title: miss   
Name: miss iesya
Date: 2005-09-21 2:06:54 AM
Thanx 4 da code.....
really help me on doing my project...
thanx alot....

Title: question   
Name: kj
Date: 2005-09-20 2:32:21 AM
could you please tell me how to export images in the html tables to the excell sheet.the excell sheet gives a blank space where the image is present.
reply to kiranjosephelavankal@indiatimes.com
Title: question   
Name: kj
Date: 2005-09-20 2:31:35 AM
could you please tell me how to export images in the html tables to the excell sheet.the excell sheet gives a blank space where the image is present.
Title: Nice Work!   
Name: Daniel Buttigieg
Date: 2005-09-17 6:53:19 AM
Excellent !! Very clearly explained and easy to follow!

Title: How to send datagrid content to email   
Name: feras tarakhan
Date: 2005-09-13 5:07:23 AM
How to send datagrid content to email by asp.net
Title: querry   
Name: vivek
Date: 2005-09-13 2:36:16 AM
i need help from you guys, coz, i developed a webservice,but some of methods, are not invoking, stating that 501 error
kindly help me
Title: Better solution   
Name: Lefinkel
Date: 2005-09-11 4:29:56 PM
Good but,
I think it is will be better to use a muliple worsheets document in real excel format so I think using :
http://dypso.free.fr/tech/asp-composant-excel.php >DypsXSL
</a> will be a better manner to do it ;)
Title: Excel Grpah   
Name: neeti
Date: 2005-09-08 4:57:22 AM
is it possible to make charts for reports from excel???
Title: Excell Format in VB.NET   
Name: Tkhalid
Date: 2005-08-31 10:24:05 AM
Actaully i have to generate a report in excell format by using crystal externally and i wants the output in excell format with data in cells, so any one can do sorting or whatever he/she wants to do like an excell sheet.

Anyone help me in this matter?
Title: Superb   
Name: B.V.N Rao
Date: 2005-08-30 6:45:13 AM
u r doing Good thing and
but I want to genarate reports from asp.net in Excel
Title: Thanks so much   
Name: justanaspguy
Date: 2005-08-29 5:30:43 PM
Wow!! Good stuff!!
Title: Excellent!   
Name: K.A.Satheesh
Date: 2005-08-27 6:56:45 AM
Excellent coding. It'll be more effective if there is code for any other Operations for accessing Excel Sheet data [ Like OLE Concept in VB]
Title: Ms   
Name: nairpooja@gmail.com
Date: 2005-08-27 4:45:56 AM
This is helpful indeed, but, i'd like to know how to export data from a spreadsheet to my HTML form? Is it possible to export data from an Excel sheet to populate my from fields?? If yes then how? Plz help!!
Title: Comments   
Name: prabhurajan, prabhu_ct@yahoo.com
Date: 2005-08-23 12:23:01 AM
This is good. But i need to import data from SQL SERVER to EXCEL. So please articulate the procedure to import data.
Title: ASP.NET Datagrid to Excel   
Name: Mark Taylor
Date: 2005-08-22 5:00:00 PM
I'm able to get my data into excel but it's dropping the headers I've set up on the datagrid. Any idea why this might be occurring?


Private Sub LoadExcel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoadExcel.Click, btnLoadExcel2.Click
Dim tw As System.IO.StringWriter
Dim hw As System.Web.UI.HtmlTextWriter

' Turn off the view state.
Me.EnableViewState = False
tw = New System.IO.StringWriter()
hw = New System.Web.UI.HtmlTextWriter(tw)

' Set the content type to Excel.
Response.ContentType = "application/vnd.ms-excel"
' Remove the charset from the Content-Type header.
Response.Charset = ""

' Get the HTML for the control.

' Write the HTML back to the browser.
Response.Write(_ConstructExcelHeader() & tw.ToString())
' End the response.
End Sub
Title: is not working in Office XP and Office 2003   
Name: narsimha chary(chary_reva@yahoo.co.in)
Date: 2005-08-17 8:50:48 AM
what ever u suggested ,it is working in Office 2000 perfectly. where as Office XP and Office 2003, it is not working. If you have any different ideas . Please let me know
Title: Can Create Two Sheets?   
Name: gdszzx@21cn.com
Date: 2005-08-09 12:05:37 AM
There are only one Excel sheet,How to Create two Sheets?
Title: Query   
Name: samnan
Date: 2005-08-08 7:43:11 AM
Can we use the same method for creating PDF Files??
If yes then how?
Title: Dynamic Excel Reports with ASP   
Name: itGUY
Date: 2005-08-04 11:34:57 AM
ExcelWriter is now called OfficeWriter and is $1,495.00 for the standard edition. Not very practical for SOHO businesses!
Title: Gud   
Name: rajeev
Date: 2005-08-03 2:15:30 AM
can u help me to upload excel sheet int sql server,from there i can upload it into asp.net page for viewing.

i need it very urgent,pls reply me at rajeevka@hclcomnet.co.in

rajeev karnatak
Title: The browser screen flashes   
Name: Monisha Das
Date: 2005-07-26 8:41:37 PM
I created an html table as given in this example. When I display the page, the screen flashes and disapplears. In the bottom status bar shows downloading message while flasing. Does this solution needs the excel application be loaded on the IIS server? I thought it will generate HTML and the browser will display it in Excel because of the content type.
Any ideas?
Title: Qustion   
Name: manpreet
Date: 2005-07-21 2:03:39 PM
i have one problem , how to exprot the jpeg into excel sheet, my whole code working in my local machine and it also export the jpeg file in to excel but when ever i lunch this code into real server it does not show my jpeg chart
images into excel sheet , in spite of images it show some dark background into the excel sheel
if u can help me please help me
Delhi India
Name: Bixapathi
Date: 2005-07-21 6:30:01 AM
The way of presentation and explaining is really excellent

Thanks a million.................
Title: Programmer   
Name: Irfan
Date: 2005-07-18 11:48:27 AM
This is nice and good site for the professional programmers in IT FIELD .

i will keep touch with this site

ur irfan
Title: How to Align the Cells   
Name: John
Date: 2005-07-14 3:15:03 AM
Pls help me
Title: In aspx   
Name: carlos
Date: 2005-07-06 2:03:59 PM
hi, how its done in aspx
Title: Excel Dough   
Name: Aundy
Date: 2005-07-06 10:54:54 AM
I was able to export to excel using c#. But the problem is to set landscape as default.
Title: Not working with dynamic data   
Name: Muneer
Date: 2005-07-05 1:55:59 AM
This article is very nice as it gives result in a single code. at the same time when I tried this code with a dynamic data which is taking from access programatically it is not working. It gives only the values which are there in the html tags only. Is there any way to do the same. I mean I need to create a table dynamically and take the selected fields from the database and have to do the same writing in excel ! Plse advice me
Title: How to send dynamically created excel file containes image as attachment file   
Name: Pratap Routray
Date: 2005-07-01 10:28:59 AM
I am facing send image file with html mail.I want to send a excel file contains image.I tried a lot to send that but in mail it is not showing tha image.Please help me to send image in mail without saving
Title: Software Engineer   
Name: Uppalapati Giri Prasad
Date: 2005-06-24 5:27:03 AM
Hi realy its good stuff
Title: hi i want to export an html as separated excel sheets 1 and 2   
Name: sathish
Date: 2005-06-23 8:00:39 AM
pls help me out for this problem to get solved.,

for your reach ,my_inbox@sify.com is my mail id.,

awaiting for your good reply.,

advance thanks,
Title: generating excel sheet using asp   
Name: aazia
Date: 2005-06-23 2:14:52 AM
What you have said will just exact the data from the database as it is but the problem with us is we are trying to generating an excel sheet with different criteria's and in different format(like not in the same order of fiels as it is in the database).
Can you plz help we will be very greatful to you and we will b glad
thank you
Title: Macros in Excel;   
Name: Ananth
Date: 2005-06-22 9:56:59 AM
By using Response.ContentType = "vnd/excel"...
I want to exceute some excel macros at the same time..

Actually i want to group some rows/columns when downloading the excelsheet on client.

can i do the same with Office Web Components , OWC.Spreadsheet

Thanks in Advance,
Title: How to align data in Excel after exporting from ASP   
Name: Ravi Kiran
Date: 2005-06-19 1:30:02 AM
Data in Excel is not getting aligned to center after exporting. How to align it? pls help me
Title: problem1   
Name: joth
Date: 2005-06-16 6:56:13 AM
hi steven smith!
i maintain tool(intranet) ,in the tool I create a button
and then click(to transfer the emp details)to excel sheet.
first time is working nicely(dialog box to open).but is not working in another machine.few times later is not working only save and view.what's problem please inform me quick as possible.i mentioned above my email!
Title: //import java.util.ArrayList;   
Name: //import java.util.ArrayList;
Date: 2005-06-16 5:55:02 AM
//import java.util.ArrayList;
//import java.util.List;
Title: Thanks and a question   
Name: Ares
Date: 2005-06-16 3:53:20 AM
Thanks for this article. Also I would like to change some cells background color too. Can I do this with ASP?
Title: problem   
Name: vjjj
Date: 2005-06-16 1:46:07 AM
i cannot use yur's website but unforunately
i can try itself to open the exec1 sheet of employee details.but the problem is i click the export to excel button one dialog box is appears open or save.i can click open new more times properly working in my system but is not workinkg other systems(you understand i thing this is intranet).other systems simply open cannot idetentify the file but save and open is properly.and after times is same problem in my sytem also.what can i do? please inform me quick as possible.fortunetly seee your website dynamically to open excel sheet.
Title: blank file   
Name: Ariffin Hasan
Date: 2005-06-14 2:17:15 AM

After loading my data in vb.net, i added the 3 lines indicated below. The pop to save or open file comes up but after saving, when i open the excel file its blank.

Pls help

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Response.AppendHeader("Content-Disposition", "attachment; filename=test.xls")
Response.ContentType = "application/ms-excel"
end sub
Title: Almost there   
Name: A373769
Date: 2005-06-03 12:59:32 PM
This has been helpful. I am able to export to excel successfully. But I have some additional requirements. I need to present the user an ASP page where they can enter new values in several input fields conatained within a form. When the user is ready I need to then export the entire page, including the new input field values to Excel. However, it appears that what is being sent to Excel is the page as it was built when the page loaded. Any ideas?
Title: Query   
Name: sri krishna
Date: 2005-06-03 2:41:29 AM
Good Stuff. i have implemented this successfully but encountered a very peculiar problem when i am trying to send my datagrid content to excel as a report its showing a dialog box asking for network username and password, instead of showing the open save and close dialog box.
could u plz suggest me how to overcome this scenario.
thx in advance. plz do mail me possible solution at alahari_srikrishna@yahoo.com

My code goes here:
If Request.QueryString("bExcel") = "1" Then
' Set the content type to Excel.
Response.ContentType = "application/vnd.ms-excel"

' Remove the charset from the Content-Type header.
Response.Charset = ""
' Turn off the view state.
Me.EnableViewState = False

Dim tw As New System.IO.StringWriter
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
' Get the HTML for the control.
' Write the HTML back to the browser.
' End the response.
End If

Sub BindData()

Datagrid1.DataSource = GetTableData(x,y,z.....)
End Sub
Title: Html pages report to Exceel sheet   
Name: Nagender Reddy
Date: 2005-06-01 4:30:13 AM
hai ,
Iam new to Asp.net ,can we pass output values to Exceel sheet from Html page,If yes how please suggest me an idea through mail.
Title: mani   
Name: mani
Date: 2005-05-25 3:12:27 PM

i am a beginner of ASP. i could do the programming in asp using ms-access as my backend.

i have a doubt in doint one of the program as,

when i click on the checkbox,


slno empid empname process checkbox1 checkbox2

either of the checkboxes, and click on the submit button, all the data must be updated on to the data base. can u help me in coding out this.
Title: need a clear solution   
Name: max
Date: 2005-05-17 10:24:01 AM
Hi freinds,
this article should be excatly what i currently need. but, after i read all of articles, i am still not very clear.
what i want to do is as below:
i already have data displayed in excel format in WEB form. now, i want to save the data to an excel file in a specfic location of client machine. what should i do?
Title: Excel Worksheet names   
Name: Jared Burford
Date: 2005-05-14 4:39:51 AM
the default name for an excel worksheet is Sheet1. so, If you change it then updated it in ASP code in order to read the sheet.

But this is still hardcodes, is there a way to change read the sheet name (dynamically) ?
Title: question   
Name: Rami zaitoun
Date: 2005-05-12 10:13:25 AM
how i can save this document and open it in microsoft
word application.

i hope to answer me.

And very thanks.
Title: mulit-sheet Excel w/o Excel.Application in ASP   
Name: manmoth
Date: 2005-05-11 1:37:36 PM
Anyone interested in a VBScript Class ASP include file that allows writing native Excel 97/2k multi-worksheet workbooks without Excel.Application or any other COM object on the server?


I've just released an alpha of it that supports multiple worksheets and random (read non-adjacent) writing of text, integer, and decimal values to cells on those sheets. I'm just trying to gauge interest before investing the development time to add formatting and formula support.

Check it out and let me know. Cheers.

Title: Gr8   
Name: Yamini
Date: 2005-05-11 6:35:00 AM
gr8 piece. helped me a lot. thanx.
Title: Text Formatting Excel Cell?   
Name: Marti Holguin
Date: 2005-05-04 6:57:08 PM
I'm using vnd.ms-excel to export Execl spreadsheets, and everything works great expect I a cell has formatted text, like CR/LFs they are stripped out, and the tetx becomes a big blob. If I use HTML BR or P or put the text in PRE then each line is a seperate Row, which wont work..

Anyone know how to replicate the ALT-ENTER feature for soft-returns (as in format text, dont move to next line)

Title: alok   
Name: azeem
Date: 2005-05-03 11:59:12 AM
great piece of code
Title: Excel Output   
Name: Calhoun
Date: 2005-04-22 5:07:40 PM
Great article!!!

This info saved my day, mate!
Title: Graphs in excel   
Name: excel' lent
Date: 2005-04-21 5:49:09 AM
Is it possible to create graphs from within an asp page which will then be exported to excel, these graphs need to be created dynamically.
Title: Work for .Net?   
Name: sfan
Date: 2005-04-14 11:03:46 AM
does it work for .Net
Title: formatting cells   
Name: Ho-Kan
Date: 2005-04-06 8:07:03 AM
Is there someone who already knows how to format cells. I have two problems: over 11 digits becomes 2,332E12 and 11-12 becomes 11-dec (is dutch notation of date). Please mail me the answer to jjansma(ad)gmail(dot)com
Title: Answer to most quests   
Name: Peter Clark
Date: 2005-03-29 5:17:03 AM
There is one simple way to solve most of the questions listed against this article.

To find out how to create multiple sheets in the same workbook, set worksheet names, etc. Simply create a WORKBOOK in excel as you wish it to be dynamically produced (rename a few sheets, etc.). Then "Save as HTML", you can now open up the HTML version of the spreadsheet in a text editor and find the relevant bit of code to use for the dynamic output.
Title: working with crystal reports in asp   
Name: crystal reports in asp examples
Date: 2005-03-29 3:37:52 AM
working with crystal reports in asp
Title: Line Feed   
Name: Steven Smith
Date: 2005-03-18 8:29:14 PM
Since this technique relies on Excel interpreting the HTML code, if you want to include line feeds, you should do so using HTML. That is, the br element or the p element. I haven't tested either, but that's the way I would go, and if it doesn't work, then I don't know how you would do it without a component like SoftArtisans' ExcelWriter.
Title: linefeed   
Name: Arsiwala
Date: 2005-03-18 7:25:31 PM
Great Content ...
I am trying to provide line feeds in a cell, as I would have done using Excel i.e ALT + Enter. Any Idea How I would accomplish this in Excel through as using vbscript. I have tried using Chr(10), Chr(13), vbLf and vbCrLf ... none of them seem to be able to make a line feed in a n Excell Cell.

Title: formatting fields   
Name: webgurl
Date: 2005-03-15 1:47:02 PM
When populating excel file from asp with varchar fields
it is dropping leading and trailing zeroes. how do you get around this? Otherwise, this is a great solution!
Title: question   
Name: Dilshad
Date: 2005-03-14 4:46:00 PM
Can we create whole workbook with this instead of just one worksheet. Like using one asp page to create multiple sheets in one excel file? Please help?
Title: Problem?   
Name: Tidus
Date: 2005-03-04 3:11:47 AM
This code seems great but i have one little problem.
When I press open or Save the browser tells me he cannot save this page because he can't find it on the server.
Any thoughts????

Title: Several worksheets in the same file   
Name: Matthi
Date: 2005-02-28 7:17:56 AM
Is it possible to add other worksheets to the same file?
Title: NA   
Name: NA
Date: 2005-02-25 11:32:32 AM
Is it possible to add another worksheet to the same file
Title: Format Excel....   
Name: Susila
Date: 2005-02-24 2:14:04 AM
I want to export DataGrid value to Excel file in Asp.net.
and also i need to format the cells from Asp.net.
any one can help me.

thanks in advance.
Title: feedback   
Name: shazia
Date: 2005-02-23 3:48:59 PM
Excellent Article!
Title: ..new sheet!   
Name: Gius
Date: 2005-02-22 6:36:46 AM
..Its very good! But how can i create plus sheet in the same exel file????
Title: Adding something to the article   
Name: Anant Johri
Date: 2005-02-10 2:50:11 AM
The article was good. Actually in my case i had a ASP page which showed certain records. On that ASP page I had a Export To Excel button. I wanted that when I click on that button an excel file should be created.So, I just had to include Response.ContentType = "application/vnd.ms-excel" in the beginning and the remaining stuff will remain the same.
Title: super   
Name: ramu
Date: 2005-01-29 6:48:41 AM
very good
Title: image to excel from asp   
Name: christian boisvert
Date: 2005-01-28 10:11:08 AM
But how can i transfert a bitmap in an excel cell from asp?
Title: Logging Excel Download   
Name: mjb
Date: 2005-01-24 12:16:28 PM
I have my ASP application saving Excel fine. I am also logging when an Excel file is generated. If a user clicks cancel on the Save As dialog, how can I detect that cancel was selected and skip the code that logs a download?
Title: feedback   
Name: jyothi
Date: 2005-01-19 1:45:49 AM
Too good!!

Thanks a lot
Title: Question   
Name: Mahesh
Date: 2005-01-18 1:36:46 AM
I am using ASP.NET Tablecontrol to create an ExcelSheet in which i Place formulas.The formulas are working fine But now i want to format the cells to nearest Decimal.ie my cell looks like this 26.00046 which i want to make it to 26.00.In the code i have done something like this
TableCell tblcell=new TableCell();
I am using Response.ContentType = "application/vnd.ms-excel" for exporting the content.
Title: concert to word   
Name: gunasekari
Date: 2005-01-17 4:40:12 AM
hi i'm try to save my word doc in client side but i used this code Response.Clear()
Response.AppendHeader("Content-Disposition","filename=" + "Title")
Response.ContentType = "application/msword"
Response.OutputStream.Write(arrFileData, 0, arrFileData.Length)
Still have some error pls help me
Title: Excellent....   
Name: Jigar Panchal
Date: 2005-01-03 10:55:36 PM
Really Good one...
do you have something for CSVs?
Title: Please Help Me   
Date: 2004-12-29 6:53:53 AM
Please Help Me
Title: Roy   
Name: Proshanta
Date: 2004-12-29 6:46:28 AM
How can I read a file name or file extension form a Uploader form.
Suppose I can upload a file i.e. doc, pdf, exl......
At a time others information save a database and file name save a data base and upload a folder.
Title: Add Muliple worksheet in Excel-97   
Name: Piyush
Date: 2004-12-28 1:56:08 AM
How to add multiple worksheet for excle 97 using this code
Title: What is a Dll for Excel   
Name: Thai people
Date: 2004-12-23 1:54:22 AM
Please tell me about dll for export report to Excel.When I use Ms excel 97 this code is work!!! but when i use Ms excel 2000 isn't work when i get values of variable in another page form.It doesn't show the record . Please help me.............
Thank you ..........";-.-"
Title: Excel File to Browser   
Name: FundooASP
Date: 2004-12-22 9:26:29 AM
Hey, I have a excel file with complete data in server. If i run the following code
sData = "test.xls"
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "content-disposition", "attachment; filename=" + sData

I get a file in my client browser which is totally blank. How would I get my orginal file to my browser window ??
Title: Title To the Excel   
Name: Lin
Date: 2004-12-16 4:50:26 AM

I would like to know if there is a way to add a title to the excel. (in my case the date).

Thanks - Lin.
Title: Excel or Word   
Name: Lydia Cheng
Date: 2004-12-09 9:39:57 PM
Which way is good(Excel or Word) to create report in server side? I use CreateObject("OWC.spreadsheet") create a sheet and write some data to it, I don't want to save it, only want to display it in a new window, can I? Thanks!
Title: Generate Word Report in Server Side using ASP   
Name: Lydia Cheng
Date: 2004-12-09 9:27:14 PM
I create a word report in the server side using CreateObject("Word.Application"), I don't want to save it in the server side or client side, I only want to dispaly the word object in the new window, How can I do it? How can I kill the WINWORD process after client close the window? Thanks!
Title: only simple calculations?   
Name: ahmed
Date: 2004-12-08 11:59:22 AM
very good...if the caluclations are complex eg macros & inculde ranges will it still work if i put the vba code in excel?
Title: If this isn't enough... ExcelWriter   
Name: Steve Smith
Date: 2004-12-08 8:35:23 AM
If this technique, which is really just a simple hack, is not sufficient for whatever special requirements you have, then I *strongly* recommend you take a look at SoftArtisans' ExcelWriter product, which will almost certainly enable you to do whatever you're trying to do.
Title: small clarification   
Name: jay
Date: 2004-12-08 12:42:44 AM
Hi this article is very fine but i face a problem i am having number of tables with different number of table data in html format i have adjusted the width but while converting to excel not getting the same format in HTML.
Title: Thanks   
Name: Meisy
Date: 2004-12-06 5:49:24 PM
Excellent! Thank you!!
Title: Authentication?   
Name: acraft
Date: 2004-12-03 12:21:08 PM
I have some code that outputs an Excel file to my browser by setting the Response.ContentType to "application/vnd.ms-excel", but I am having a problem. Some users (myself included) get a login window when they load the page in IE (but it works fine in FireFox). If they hit cancel, the page will load up fine, but it is still kind of a nuisance. It's more of a problem that IE will arbitrarily place the login window behind the temporarily disabled IE window, and most users don't know how to use ALT+TAB to get to it.

I post this comment here, because out of the numerous tutorials for this subject that I've looked at on my computer, this is one of few that does not uselessly ask for authorization before displaying the Excel output. Any ideas why not?

Thanks a lot!

Title: Works well   
Name: Jay Healey
Date: 2004-12-02 6:01:38 AM
Simple, easy and it works.

Title: How to save the file instead of opening   
Name: Jack
Date: 2004-11-19 2:33:23 AM

Anyone can help me with a request?

The above solution is fabulous but I need something extra. Instead of opening the file in the IE for modification, my website will provide a link to generate the Excel file automatically and prompt users to save the file using system "Save As..." function.

Can any kind soul please help :)

Title: Much needed   
Name: Sameer Lal
Date: 2004-11-11 9:56:35 PM
Great job.Looking for it for a long time!
Title: RE: formatting   
Name: 2perplexed
Date: 2004-11-09 5:20:00 PM
I am having the same problem...have yet to figure it out for Excel 2000. However, if you know you are delivering for Excel 2002 (XP), you can generate the output from your webpage in XML format.

Here is an example: http://www.experts-exchange.com/Web/Web_Languages/XML/Q_20919841.html

And here is a reference: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexcl2k2/html/odc_xmlss.asp?FRAME=true#odc_xmlss_ss:Workbook

Any solutions yet for non-XML?
Title: BigJatt   
Name: Abid Hussain
Date: 2004-11-08 7:18:46 AM
Very Goooooooooooooood
Title: thanks   
Name: Tony Reid
Date: 2004-10-25 8:04:42 AM
Thanks for this - its very useful :)
Title: Help   
Name: lasa
Date: 2004-10-24 7:19:43 AM
Hey, any of you know a way to export data in a excel sheet to a table in sql. What i want is to give user the ability to export a excel file in his pc to sever.
Title: Feedback   
Name: Geoff Johns
Date: 2004-10-22 7:20:39 AM
Excellent work.
Title: Excel Sheet   
Name: Bhaskara
Date: 2004-10-19 10:56:13 PM
Hi ananth, u can work out with this..

"attachment; filename=" + "Title");
Response.ContentType = "application/ms-excel";
Response.OutputStream.Write(arrFileData, 0, arrFileData.Length);
Title: Excel Sheet   
Name: Ananth
Date: 2004-10-18 5:28:33 AM
The Article is very good.
Can i have any idea of how to save the excel sheet in the client side (Client User).
Title: Problem with conversion of html to excel   
Name: Spacy
Date: 2004-10-05 1:51:05 AM

Great input!!! But am facing a problem. On the page load am getting the data for the table from sql. Same data is used for displaying two different tables depending on user selection. Here, depending on the user selection, i call a method displayTable() which is used to display the table.

On the click of a button "Export to Excel" i write the code response.content.... It generates the excel file but with a red cross sign. I guess the problem is it that it is not getting the data since the entire code which fetches data from sql is written in - if not page.isPostBack else it gives me duplicate data.

Could you please help me with this? Any workarounds???

Thanks in advance.

Title: Can i send an Excel Worksheet object through Response ?   
Name: niktesla
Date: 2004-10-03 2:29:52 AM
Hi there.
I have some situation...
i already have a DLL which is creating some Reports in Excel. So I want to use this DLL and send to client side the content of WorkSheet objects created by DLL.
At the same time i dont want to save this worksheets in .xls file on server side and send to client a Link to it because no 1 can give a garanty from another user to request the same and to rewrite this file before 1st client to download it.

The question is - Can i write to Response the content of my WorkSheet object in some way and to force client browser to interperet it as Excel Page ?

Thanks anyway,
Vladimir Askenov
Title: how can i change worksheet name??   
Name: Tania
Date: 2004-09-27 11:19:10 AM
i need to name the worksheet dynamically. The Response.AddHeader "Content-Disposition","filename=yourname.xls" works for the filename but excel assumes the worksheet name is the same as the filename. How do i name the worksheet "myname" instead of Sheet1 or the file name.
Title: formatting   
Name: Pete C
Date: 2004-09-27 6:59:45 AM
How can I format cells? I'm populating a cell with a character string, but if that string happens to be numeric, then it displays in floating-point format!
Title: Question   
Name: Hrishikesh Joshi
Date: 2004-09-17 4:54:13 AM
If I want to open a text file using contenttype="text/plain" in Netscape why it is taking the default contenttype="text/html" instead of opening the text file in notepad.
I have added text file type in Helper Applications in preferences of Netscape.
Title: To change filename dynamically(based on some request value)   
Name: Reghu
Date: 2004-09-10 4:04:47 AM
Hi Smith,
I need to change the excel file name based on the request value. ie the file name is supplied through a request attribute from the server.
Is it possible to change the file name dynamically??

If you find time please do reply to my email id mentioned in the url field above.
Title: change filename   
Name: jon
Date: 2004-08-27 1:53:27 PM
yes, thanks steven.

Also, to answer previous question, change the file name by adding this line:

Response.AddHeader "Content-Disposition","filename=yourname.xls"
Title: good   
Name: akang
Date: 2004-08-14 3:19:35 AM
good stuff...thanks bro
Title: question   
Name: double
Date: 2004-08-11 11:35:40 PM
How can I name the worksheet?
not use the default
Title: Chaudhary   
Name: Pradeep
Date: 2004-08-05 3:42:23 AM
Good Stuff!!!

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-06-15 4:04:06 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search