473,385 Members | 1,347 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,385 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 11664
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.