By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,131 Members | 1,437 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,131 IT Pros & Developers. It's quick & easy.

Export from VB.NET 2003 to an Excel spreadsheet

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.