Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

fille Excel with Datatable

Posted on 2013-11-11
2
Medium Priority
?
314 Views
Last Modified: 2013-11-25
Is there a way to fill Excel with datatable in vb.net and save it as a file?
0
Comment
Question by:VBdotnet2005
2 Comments
 
LVL 30

Accepted Solution

by:
anarki_jimbel earned 1000 total points
ID: 39640574
There are examples and tutorial on Internet. You may find one on the MSDN web site:

http://code.msdn.microsoft.com/office/Export-DataTable-object-to-b3e2c1f0

The link is about importing dataset into Excel using VB.Net.
0
 
LVL 20

Assisted Solution

by:ElrondCT
ElrondCT earned 1000 total points
ID: 39640711
The method shown in the article anarki_jimbel links to will work, but it's painfully slow. If your output has more than a few thousand cells, the overhead of doing each cell individually will kill you. You're much better off loading an array with the values from the DataTable, then loading the entire array into Excel using a command like
Dim oRange As Excel.Range = excelWorkSheet.Range("A1")
oRange.Value = oData

Open in new window

where excelWorkSheet is an individual sheet in a receiving Excel workbook (file) and oData is a two-dimensional array of values, which you would completely load before executing these lines.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Screencast - Getting to Know the Pipeline
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question