Click here to Skip to main content
15,881,139 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to export large data(about 3lakh records) from database to excel through web application in c#? The time limit should be more precise...?
Posted
Comments
Reiss 14-Jul-11 5:37am    
Please note that not everyone will understand the Indian numbering system. 3lakh is three hundred thousand.

What version of excel are you exporting to, as older versions can only contain 65,536 rows.
shan.it 14-Jul-11 5:52am    
Sorry...! Then how can i export such large data to excel is there any other possible ways..?
shan.it 14-Jul-11 5:42am    
Sorry...! Then how can i export such large data to excel is there any other possible ways..?
Reiss 14-Jul-11 5:54am    
What do you want to do with the data once it has been exported - is it going to be fed into another system or viwed by a user?
shan.it 14-Jul-11 5:56am    
It will be used by the user to keep for further reference..!

I do not think it is possible to export data of 3 lakh records to excel as Excel has the capability to have maximum 65'536 rows. So, the only way is to add in next sheet in the same excel file.

Here is wonderful example for exporting dataset to mulitple excel sheets - Export DataSet to Multiple Excel Sheets[^]
 
Share this answer
 
v3
Comments
shan.it 14-Jul-11 5:44am    
K is there any possible other ways to export 65536 records to excel with considering the performance issue of my web application...?
If your end users are using Excel 2003 or older, you are going to need to split the output into either
  • several different workbooks
    • several different worksheets in a single workbook
based on some logical split - e.g. product type(maybe your web app can ask user for split).

If they are using Excel 2007 this restriction largely goes away MSDN[^], however you need to remember that if all the data is in one workbook (using the several worksheets, or Excel 2007 approach) it will take a long time to open.

Regardless of which approach you take I would suggest that you design a web front end that accepts the request, which then fires an asynchronous process to export the data and send it to them (perhaps zipped via e-mail) once it has completed.
 
Share this answer
 
Try this


http://aspnetlibrary.com/articledetails.aspx?article=How-to-export-a-GridView-to-Excel[^]



http://www.c-sharpcorner.com/uploadfile/dipalchoksi/exportxl_asp2_dc11032006003657am/exportxl_asp2_dc.aspx[^]



dont forget to do this.

public override void VerifyRenderingInServerForm(Control control)
{
// Confirms that an HtmlForm control is rendered for the
specified ASP.NET server control at run time.
}



First of all bind gridview and export it into excel the above link might help you
 
Share this answer
 
v3
Comments
Reiss 14-Jul-11 6:41am    
A datagrid with 300,000 rows (I don't know how many columns) - even if paged for display on the screen, you would need to fetch it all for the download - this is going to take a very long time.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900