467,923 Members | 1,449 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,923 developers. It's quick & easy.

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
  • viewed: 11410
Share:
3 Replies
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Jason | last post: by
1 post views Thread by Ellen Manning | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.