473,230 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,230 software developers and data experts.

Export from VB.NET 2003 to an Excel spreadsheet

I'm trying to figure out a way to export data (actually the result of a
Stored Procedure call from SQL Server) into a specified Excel spreadsheet
format.
Currently, I have the data read into a DataSet that consists of one
DataTable.

That DataTable has a specific name (for arguments purposes, let's say it's
called "DataGrid"), that I need to use as the tab name in the exported Excel
spreadsheet.

That DataTable has specific column names, which I want to use as the first
row on that worksheet (of the exported Excel). I then want to use the
remaining rows to populate the rest of the cells in the spreadsheet.
Is there an easy way to do this?
I am currently using an OleDBAdapter object to read from an Excel
spreadsheet (something that would also apply to this newly-exported Excel
spreadsheet), and using it's Filll method to populate a DataSet.
Is there an easy way to do it the other way, going from a DataSet (or
DataTable) to an Excel spreadsheet?
Thanks!

-Scott
Jan 12 '06 #1
3 11649
I don't know of any built in function that creates excel but ther one for
XML I just create CSV file (don't forget about the commas) or you may open
Excel document using office automation and populate the document
I can send you some sample code

hth,
Shmuel Shulman

"Scott M. Lyon" <sc******************@rapistan.BLUE.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I'm trying to figure out a way to export data (actually the result of a
Stored Procedure call from SQL Server) into a specified Excel spreadsheet
format.
Currently, I have the data read into a DataSet that consists of one
DataTable.

That DataTable has a specific name (for arguments purposes, let's say it's
called "DataGrid"), that I need to use as the tab name in the exported
Excel spreadsheet.

That DataTable has specific column names, which I want to use as the first
row on that worksheet (of the exported Excel). I then want to use the
remaining rows to populate the rest of the cells in the spreadsheet.
Is there an easy way to do this?
I am currently using an OleDBAdapter object to read from an Excel
spreadsheet (something that would also apply to this newly-exported Excel
spreadsheet), and using it's Filll method to populate a DataSet.
Is there an easy way to do it the other way, going from a DataSet (or
DataTable) to an Excel spreadsheet?
Thanks!

-Scott

Jan 12 '06 #2
JFB
Check this out
http://www.vbdotnetheaven.com/Code/Jul2003/2124.asp
Rgds
JFB

"S Shulman" <sm*******@hotmail.com> wrote in message
news:O0*************@TK2MSFTNGP14.phx.gbl...
I don't know of any built in function that creates excel but ther one for
XML I just create CSV file (don't forget about the commas) or you may open
Excel document using office automation and populate the document
I can send you some sample code

hth,
Shmuel Shulman

"Scott M. Lyon" <sc******************@rapistan.BLUE.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I'm trying to figure out a way to export data (actually the result of a
Stored Procedure call from SQL Server) into a specified Excel spreadsheet
format.
Currently, I have the data read into a DataSet that consists of one
DataTable.

That DataTable has a specific name (for arguments purposes, let's say
it's called "DataGrid"), that I need to use as the tab name in the
exported Excel spreadsheet.

That DataTable has specific column names, which I want to use as the
first row on that worksheet (of the exported Excel). I then want to use
the remaining rows to populate the rest of the cells in the spreadsheet.
Is there an easy way to do this?
I am currently using an OleDBAdapter object to read from an Excel
spreadsheet (something that would also apply to this newly-exported Excel
spreadsheet), and using it's Filll method to populate a DataSet.
Is there an easy way to do it the other way, going from a DataSet (or
DataTable) to an Excel spreadsheet?
Thanks!

-Scott


Jan 12 '06 #3
JFB
Maybe this is better for you!
http://www.codeproject.com/vb/net/Data_Extract.asp
JFB

"S Shulman" <sm*******@hotmail.com> wrote in message
news:O0*************@TK2MSFTNGP14.phx.gbl...
I don't know of any built in function that creates excel but ther one for
XML I just create CSV file (don't forget about the commas) or you may open
Excel document using office automation and populate the document
I can send you some sample code

hth,
Shmuel Shulman

"Scott M. Lyon" <sc******************@rapistan.BLUE.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I'm trying to figure out a way to export data (actually the result of a
Stored Procedure call from SQL Server) into a specified Excel spreadsheet
format.
Currently, I have the data read into a DataSet that consists of one
DataTable.

That DataTable has a specific name (for arguments purposes, let's say
it's called "DataGrid"), that I need to use as the tab name in the
exported Excel spreadsheet.

That DataTable has specific column names, which I want to use as the
first row on that worksheet (of the exported Excel). I then want to use
the remaining rows to populate the rest of the cells in the spreadsheet.
Is there an easy way to do this?
I am currently using an OleDBAdapter object to read from an Excel
spreadsheet (something that would also apply to this newly-exported Excel
spreadsheet), and using it's Filll method to populate a DataSet.
Is there an easy way to do it the other way, going from a DataSet (or
DataTable) to an Excel spreadsheet?
Thanks!

-Scott


Jan 12 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jason | last post by:
Can anyone point me to some sample code or tutorial that shows how I can export data from a database to an Excel spreadsheet that is already created on the server? I have an Excel spreadsheet...
4
by: Paolo | last post by:
Friends, I need help with some code to export different tables to a single spreadsheet in Excel. My excel file is named REPORT and the spreadsheet is named CLIENTS. I do have the code to export...
4
by: Gary Wright | last post by:
I have an Access 2K database split into front and back. Quite often the users want to do some data analysis that I have not created a report for so they want to export some subset of the data into...
1
by: Ellen Manning | last post by:
I'm trying to export an Excel2K spreadsheet to A2K. Here is a sample of the Excel spreadsheet: LastName FirstName Hours Location HoursPercent Doe John ...
3
by: excyauseme | last post by:
Hi guys! Do you know what is the best way to export a text file, this one is a log file that is already comma delimited thru a module run by my access database, to an excel spreadsheet? I need to...
1
by: smaczylo | last post by:
Hello, I've recently been asked to work with Microsoft Access, and while I feel quite comfortable with Excel, I'm at a complete loss with databases. If someone could help me with this issue I'm...
1
by: cehether | last post by:
Hello everyone. I am trying to export the contents of a DataGrid to MS Excel using VB.NET 2003. I read of a couple different ways of doing that here (though I couldn't tell which version of...
7
Merlin1857
by: Merlin1857 | last post by:
Its great producing data for users to look at in your web pages and generally that is sufficient for their needs but sometimes you may want to supply your user with the data in a form they can...
3
by: jmarcrum | last post by:
I want to export a report (that contains two separate queries, 1. Current year data, and 2. split-year data) from access into excel, but everytime I run my code and export the data to excel, it looks...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.