Dynamic Excel Reports with ASP
page 1 of 3
Published: 20 Sep 2003
Abstract
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
Feedback
Average Rating: 
Views (Total / Last 10 Days): 374487/ 945
Article Contents:

Technique

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

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 3 and 5 and type the answer here:

User Comments

Title: asp vb - get data from sever and submit response.redirect to web service server   
Name: mr zack
Date: 11/10/2008 5:00:53 AM
Comment:
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.MoveNext
loop
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: 10/22/2008 2:21:47 AM
Comment:
Hi,
i want create bar chart dynamically use the datatable creted at runtime..........
Title: Export data to Excel from ASP   
Name: Juan Carlos
Date: 10/15/2008 12:02:39 PM
Comment:
(FROM PERUVIAN)
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: 9/19/2008 4:01:24 AM
Comment:
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: 9/11/2008 3:37:03 AM
Comment:
Iam Not able to export to excle using this
Title: problem exporting to various worksheets   
Name: akhtar
Date: 8/7/2008 9:40:33 AM
Comment:
Hi
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: 7/20/2008 5:34:08 AM
Comment:
Hi,

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

Regards
BVVPrasad
Title: Some issue   
Name: BVVPrasad
Date: 7/16/2008 2:30:47 AM
Comment:
Hi,

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

Regards
BVVPrasad
Title: get field name only once   
Name: brunda
Date: 7/4/2008 6:19:43 AM
Comment:
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: 6/20/2008 2:35:23 AM
Comment:
Hi,
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.

Thanks
mailme @ : abhisheka.sinha@gmail.com
Title: Good   
Name: vishal
Date: 6/11/2008 8:33:09 AM
Comment:
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: 5/29/2008 12:52:44 PM
Comment:
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.

Thanks
Title: Line Feed   
Name: Sudheer
Date: 5/13/2008 10:59:42 AM
Comment:
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: 5/5/2008 8:00:47 AM
Comment:
Hi,
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: 4/25/2008 1:32:30 AM
Comment:
i have used the method u have been described above but it appearing blank
Title: Excel Cell Formatting Problem   
Name: Srinivas Alwala
Date: 4/21/2008 10:29:43 AM
Comment:
Hi,

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.

Regards,

Srinivas Alwala
Title: embed image to excel from asp   
Name: Ashwini
Date: 4/21/2008 5:48:50 AM
Comment:
Hi,
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: 4/21/2008 3:33:13 AM
Comment:
Hi,
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: 4/17/2008 1:41:09 AM
Comment:
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: 4/4/2008 7:29:38 AM
Comment:
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,
Anupam
Title: Question to j0ksta   
Name: Giri
Date: 4/2/2008 7:23:17 AM
Comment:
Hi,
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
Name: CHANGE SHEET NAMES AND PROTECTION
Date: 1/27/2006 2:24:41 PM
Comment:
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:

[xml]
[x:ExcelWorkbook]
[x:ExcelWorksheets]
[x:ExcelWorksheet]
[x:Name]Worksheet Name[/x:Name]
[x:WorksheetOptions]
[x:ProtectContents]False[/x:ProtectContents]
[/x:WorksheetOptions]
[/x:ExcelWorksheet]
[/x:ExcelWorksheets]
[/x:ExcelWorkbook]
[/xml]

That's It! Remember to replace "[" with "<" and "]" with ">"
Title: Issue with Excel page not popping up automatically.   
Name: Akhil Vig
Date: 3/5/2008 9:46:40 AM
Comment:
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: 2/26/2008 7:51:11 AM
Comment:
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: 2/12/2008 2:39:11 AM
Comment:
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?

Millan
Title: GOOD   
Name: R.G.GUPTA
Date: 2/6/2008 6:02:27 AM
Comment:
GOOD IT WORKING FINE
Title: Mrs   
Name: Kalpana Srikant
Date: 1/26/2008 5:31:18 AM
Comment:
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: 1/11/2008 10:52:04 AM
Comment:
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: 12/17/2007 1:44:54 AM
Comment:
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: 12/10/2007 8:13:30 AM
Comment:
hi..........
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: 11/24/2007 1:21:34 AM
Comment:
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: 11/22/2007 12:29:10 AM
Comment:
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: 11/12/2007 1:50:21 PM
Comment:
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.Clear
Response.Redirect (reports/24HourSummary_Shift.rpt?user0=XXXXXX&password0=XXXXXXX”)
Response.End
%>
Title: Excellent   
Name: Noman
Date: 10/28/2007 6:09:28 PM
Comment:
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: 10/27/2007 4:03:06 AM
Comment:
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: 10/15/2007 8:24:29 AM
Comment:
Hi,
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.
Thanks
Shiva
Title: data retreave from html view source   
Name: srinivasulu
Date: 9/12/2007 1:30:51 PM
Comment:
i want get the data from html view source of any page
Title: better than this   
Name: nitin
Date: 9/12/2007 11:19:19 AM
Comment:
i also write code for excel. just 10 lines
if anyone want mail me
nitin.khadloya@rediffmail.com
Title: select a particular sheet for writing   
Name: Sundareshwar
Date: 8/31/2007 5:05:48 AM
Comment:
Hi,
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: 8/20/2007 2:50:48 AM
Comment:
Great code..

but

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

regards
Title: export to word   
Name: Ramesh
Date: 7/25/2007 12:11:37 PM
Comment:
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: 7/5/2007 6:33:30 PM
Comment:
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: 6/28/2007 7:49:10 AM
Comment:
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: 6/15/2007 4:58:41 AM
Comment:
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   
Name: BUBAI BANERJEE
Date: 6/8/2007 8:11:36 AM
Comment:
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: 6/5/2007 4:57:42 PM
Comment:
perfect....
Title: Save without Save open dialog box   
Name: Rajeev Maithani
Date: 5/31/2007 4:52:58 AM
Comment:
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: 5/30/2007 10:53:08 AM
Comment:
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: 4/27/2007 4:05:31 PM
Comment:
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: 4/26/2007 7:33:32 AM
Comment:
i need a code to insert excel columns into an access database. pls help me ----> gaguru@gmail.com
Title: excel to access db   
Name: guru
Date: 4/26/2007 7:31:53 AM
Comment:
i need a code to insert excel columns into an access database. pls help me anybody
Title: not satisfied   
Name: rohit
Date: 4/3/2007 6:24:42 AM
Comment:
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   
Name: YUVARAJ
Date: 3/29/2007 6:23:56 AM
Comment:
I NEED THE CODE TO GENERATE THE EXCEL SHEET WHICH RRETERVING THE DATA FROM THE MS SQL SERVER.
PLS HELP ME
Title: asp   
Name: as your wish
Date: 3/26/2007 5:44:15 AM
Comment:
good. keep it up
Title: question   
Name: sandeep
Date: 2/26/2007 2:01:21 AM
Comment:
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: 2/3/2007 11:58:25 AM
Comment:
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
shyamfrnd@hotmail.com
Title: question   
Name: indu
Date: 1/30/2007 8:29:48 PM
Comment:
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: 1/11/2007 8:05:23 PM
Comment:
Great tip - works a treat
Title: Excel Data retreive from Access Database and display in asp   
Name: Nadeem
Date: 12/18/2006 8:00:20 AM
Comment:
\
\
\
\
\
\
Title: code in C# asp.net   
Name: parag
Date: 11/29/2006 5:52:07 AM
Comment:
can u give code for the same in asp.net using c#
Title: Excel Importing   
Name: Bhargavi
Date: 11/27/2006 12:47:18 AM
Comment:
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: 11/21/2006 9:45:49 PM
Comment:
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: 11/6/2006 5:20:19 AM
Comment:
Thank you
Title: dotnet dev   
Name: john
Date: 10/19/2006 12:06:37 AM
Comment:
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: 10/11/2006 12:58:21 PM
Comment:
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
thanks
Title: transpose   
Name: bhaks
Date: 10/5/2006 5:20:35 PM
Comment:
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: 10/2/2006 1:36:32 PM
Comment:
Thanks...
And some code for making the file name. Response.AddHeader "content-disposition", "attachment; filename="YourFileName.xls"
Title: Question   
Name: Piyush Sharma
Date: 9/20/2006 1:52:26 AM
Comment:
Thanks Steven,
How can i export data from textboxes to excelsheet in some predefined columns ?
Title: SE Trainee   
Name: Diya
Date: 9/14/2006 4:47:57 AM
Comment:
Hi

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: 8/29/2006 5:44:12 AM
Comment:
It Works!!!
I love you, you sweet sweet guru.

Debbie
Title: question   
Name: Raj Sherawat
Date: 8/17/2006 8:39:35 AM
Comment:
what is defirence vb & vb.net and this program software???
Title: same cell formatting   
Name: uhg
Date: 8/9/2006 12:38:57 PM
Comment:
http://www.ozgrid.com/forum/showthread.php?p=282729#post282729
Title: soft return??? !!!   
Name: uga
Date: 8/9/2006 12:34:16 PM
Comment:
this wont take my code!!!!!!!!
Title: question   
Name: puviyarasan
Date: 8/9/2006 9:00:03 AM
Comment:
how to handle the multiple worksheets
Title: How multiple excel sheet creation in asp   
Name: velmurugan
Date: 8/7/2006 1:59:38 AM
Comment:
How to create one excel file in multiple excel sheet creation using asp
Title: excle report   
Name: suresh
Date: 8/4/2006 7:41:46 AM
Comment:
hi,
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: 7/20/2006 5:37:35 AM
Comment:
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.
anup.daware@gmail.com
Title: Ms   
Name: Priya
Date: 7/6/2006 2:20:09 AM
Comment:
good work
Title: my comments >>site   
Name: fawad
Date: 7/3/2006 1:19:26 AM
Comment:
its not that good
Title: consolidating many wksheets   
Name: anju
Date: 6/30/2006 6:59:54 AM
Comment:
Hi,
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.

Thanks,
Anju
Title: This sample doesn't import into an Access DB   
Name: Woo Raphael
Date: 6/27/2006 12:40:34 PM
Comment:
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: 6/26/2006 1:36:20 AM
Comment:
Good Stuff
Thanks!
Title: How to export to excel... continuation to Sheet2   
Name: MLSL
Date: 6/8/2006 4:01:09 AM
Comment:
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: 6/8/2006 2:45:38 AM
Comment:
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: 6/7/2006 4:29:55 AM
Comment:
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: 6/7/2006 1:51:11 AM
Comment:
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: 6/4/2006 6:03:43 PM
Comment:
Thanks!!
Good work Bro..
Title: singh   
Name: bipin
Date: 5/29/2006 2:57:39 AM
Comment:
insert picture into excel file
Title: problem   
Name: harshal
Date: 5/26/2006 8:36:25 AM
Comment:
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: 5/10/2006 10:34:59 AM
Comment:
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: 5/3/2006 3:17:03 AM
Comment:
Hi
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?
Kiran
Title: Gipl   
Name: Ganesh lal bairwa
Date: 5/2/2006 9:58:33 AM
Comment:
it is really a good programming practice.
i liked it very much.
thanks for provide it free
Title: question   
Name: jatin
Date: 4/5/2006 5:36:59 PM
Comment:
Hi,
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 .
Thanx
Title: Exporting Datafrom SQL Server   
Name: Lisa
Date: 3/29/2006 12:08:59 PM
Comment:
Hiya
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: 3/18/2006 9:20:03 AM
Comment:
\
\
Title: as coun   
Name: as coun
Date: 3/17/2006 6:12:50 AM
Comment:
as coun
Title: Zindani   
Name: Raveesh
Date: 3/16/2006 1:33:42 AM
Comment:
Hi,

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.

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

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: 3/3/2006 1:10:01 AM
Comment:
In asp how to create multiple sheets in a single workbook with code.reply immediately
Title: Question to j0ksta   
Name: Vyas
Date: 3/1/2006 2:39:55 AM
Comment:
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
Name: CHANGE SHEET NAMES AND PROTECTION
Date: 1/27/2006 2:24:41 PM
Comment:
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:

[xml]
[x:ExcelWorkbook]
[x:ExcelWorksheets]
[x:ExcelWorksheet]
[x:Name]Worksheet Name[/x:Name]
[x:WorksheetOptions]
[x:ProtectContents]False[/x:ProtectContents]
[/x:WorksheetOptions]
[/x:ExcelWorksheet]
[/x:ExcelWorksheets]
[/x:ExcelWorkbook]
[/xml]

That's It! Remember to replace "[" with "<" and "]" with ">"
Title: gf   
Name: gf
Date: 2/27/2006 1:25:18 AM
Comment:
gfgf
Title: covert an .aspx file in .PDF format   
Name: Ajit
Date: 2/21/2006 11:38:58 PM
Comment:
can I generate covert an .aspx file in .PDF format without using Crystal Report As my Server Doesn't support Crystal Report....
ajit@lnsel.com
Title: Multiple worksheets   
Name: Vyas
Date: 2/13/2006 5:12:33 AM
Comment:
How to add multiple worksheets to an excel
Title: Just what I was looking for   
Name: WebDever
Date: 2/8/2006 5:45:43 PM
Comment:
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: 2/6/2006 2:14:17 AM
Comment:
Nice code.
Title: Dynamically naming the sheets in excel   
Name: Lakshmi Kumar Manyam
Date: 1/30/2006 4:14:00 AM
Comment:
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   
Name: CHANGE SHEET NAMES AND PROTECTION
Date: 1/27/2006 2:24:41 PM
Comment:
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:

[xml]
[x:ExcelWorkbook]
[x:ExcelWorksheets]
[x:ExcelWorksheet]
[x:Name]Worksheet Name[/x:Name]
[x:WorksheetOptions]
[x:ProtectContents]False[/x:ProtectContents]
[/x:WorksheetOptions]
[/x:ExcelWorksheet]
[/x:ExcelWorksheets]
[/x:ExcelWorkbook]
[/xml]

That's It! Remember to replace "[" with "<" and "]" with ">"
Title: Excel to asp or html   
Name: Raj
Date: 1/27/2006 12:51:52 PM
Comment:
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: 1/26/2006 1:42:30 PM
Comment:
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: 1/23/2006 11:40:11 PM
Comment:
Hi,

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.

Thanks
Priya
Title: How to export dynamic HTML table in asp page to excel   
Name: Alok
Date: 1/19/2006 7:03:34 AM
Comment:
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
Alok
email : alok@scarlettech.com
Title: How to Convert Asp.net Page content to excel   
Name: mitul shah
Date: 1/7/2006 4:37:22 AM
Comment:
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: 12/28/2005 2:14:44 AM
Comment:
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: 12/27/2005 5:57:59 AM
Comment:
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: 12/23/2005 6:04:33 AM
Comment:
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: 12/19/2005 8:53:51 AM
Comment:
You have done an excellent thing in a short code.. Keep it up!!!.. best luck

Thanks
Title: Problem exporting Crystal Reports to Excel & Word on some PCs   
Name: Anand Ajgaonkar
Date: 12/16/2005 5:46:43 AM
Comment:
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?
Thanks.
Title: pab   
Name: pabmohan
Date: 12/9/2005 5:16:31 AM
Comment:
Hi,
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: 12/8/2005 12:05:38 AM
Comment:
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: 12/3/2005 4:24:29 AM
Comment:
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,
Asheesh
Title: Jain   
Name: Ashish
Date: 11/30/2005 7:18:26 AM
Comment:
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.
Thanks
Ashish jain
Title: Question SQL Server   
Name: BSL
Date: 11/22/2005 11:21:27 PM
Comment:
hi
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: 11/12/2005 2:15:25 AM
Comment:
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: 11/11/2005 5:10:53 AM
Comment:
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.


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

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

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: 9/24/2005 9:13:47 AM
Comment:
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: 9/22/2005 2:34:27 AM
Comment:
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
Suardi
Title: question file name   
Name: No name
Date: 9/21/2005 11:18:40 AM
Comment:
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: sdfdfs   
Name: sdffsddsf
Date: 9/21/2005 11:17:34 AM
Comment:
ikk
Title: miss   
Name: miss iesya
Date: 9/21/2005 2:06:54 AM
Comment:
Thanx 4 da code.....
really help me on doing my project...
thanx alot....

muahhh....
Title: question   
Name: kj
Date: 9/20/2005 2:32:21 AM
Comment:
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: 9/20/2005 2:31:35 AM
Comment:
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: 9/17/2005 6:53:19 AM
Comment:
Excellent !! Very clearly explained and easy to follow!

Cheers!
Title: How to send datagrid content to email   
Name: feras tarakhan
Date: 9/13/2005 5:07:23 AM
Comment:
How to send datagrid content to email by asp.net
Title: querry   
Name: vivek
Date: 9/13/2005 2:36:16 AM
Comment:
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: 9/11/2005 4:29:56 PM
Comment:
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: hi all   
Name: hi
Date: 9/11/2005 6:28:18 AM
Comment:
no comment just free palestine and jerusalem the capital of palestine



DFLP
Title: Excel Grpah   
Name: neeti
Date: 9/8/2005 4:57:22 AM
Comment:
is it possible to make charts for reports from excel???
Title: Excell Format in VB.NET   
Name: Tkhalid
Date: 8/31/2005 10:24:05 AM
Comment:
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: 8/30/2005 6:45:13 AM
Comment:
u r doing Good thing and
but I want to genarate reports from asp.net in Excel
Title: Thanks so much   
Name: justanaspguy
Date: 8/29/2005 5:30:43 PM
Comment:
Wow!! Good stuff!!
Title: Excellent!   
Name: K.A.Satheesh
Date: 8/27/2005 6:56:45 AM
Comment:
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: 8/27/2005 4:45:56 AM
Comment:
HI,
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: 8/23/2005 12:23:01 AM
Comment:
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: 8/22/2005 5:00:00 PM
Comment:
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?

Thanks

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.
dgAgentSummary.RenderControl(hw)

' Write the HTML back to the browser.
Response.Write(_ConstructExcelHeader() & tw.ToString())
' End the response.
Response.End()
End Sub
Title: is not working in Office XP and Office 2003   
Name: narsimha chary(chary_reva@yahoo.co.in)
Date: 8/17/2005 8:50:48 AM
Comment:
Hi,
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: 8/9/2005 12:05:37 AM
Comment:
There are only one Excel sheet,How to Create two Sheets?
TKS.
Title: Query   
Name: samnan
Date: 8/8/2005 7:43:11 AM
Comment:
Can we use the same method for creating PDF Files??
If yes then how?
Title: Dynamic Excel Reports with ASP   
Name: itGUY
Date: 8/4/2005 11:34:57 AM
Comment:
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: 8/3/2005 2:15:30 AM
Comment:
hi,
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

regards,
rajeev karnatak
India
Title: The browser screen flashes   
Name: Monisha Das
Date: 7/26/2005 8:41:37 PM
Comment:
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: 7/21/2005 2:03:39 PM
Comment:
Good
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
thanx
Manpreet
Delhi India
Title: SIMPLY SUPERB   
Name: Bixapathi
Date: 7/21/2005 6:30:01 AM
Comment:
The way of presentation and explaining is really excellent

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

i will keep touch with this site

thanx
bye
ur irfan
Title: How to Align the Cells   
Name: John
Date: 7/14/2005 3:15:03 AM
Comment:
Pls help me
Title: In aspx   
Name: carlos
Date: 7/6/2005 2:03:59 PM
Comment:
hi, how its done in aspx
Title: Excel Dough   
Name: Aundy
Date: 7/6/2005 10:54:54 AM
Comment:
Hi,
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: 7/5/2005 1:55:59 AM
Comment:
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: 7/1/2005 10:28:59 AM
Comment:
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: 6/24/2005 5:27:03 AM
Comment:
Hi realy its good stuff
Title: hi i want to export an html as separated excel sheets 1 and 2   
Name: sathish
Date: 6/23/2005 8:00:39 AM
Comment:
hi,
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: 6/23/2005 2:14:52 AM
Comment:
helo,
What you have said will just exact the data from the database as it is but the prob