Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Can I use excel to insert rows to a table?

Author  Topic 

tommiwan
Starting Member

2 Posts

Posted - 2008-10-01 : 11:54:38
I used excel to create a connection to SQL server. I can view my table in excel, but now I would like to add rows to the table and publish those changes back to SQL server. Is this possible? I am using excel 2007, and SQL server 2008.

In case you are wondering we have automated test scripts that read from the SQL table, and we want users who do not know T-sql to be able to add rows for the automated tests to process.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-01 : 13:12:11
You can do that. just use OPENROWSET

http://msdn.microsoft.com/en-us/library/ms190312.aspx


it will be something like

INSERT INTO Table
SELECT fields FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=fullpath\yourexcelfilename.xls', [Yoursheetname$])
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-01 : 13:17:20
here's a kb article explaining various methods

http://support.microsoft.com/kb/321686
Go to Top of Page

tommiwan
Starting Member

2 Posts

Posted - 2008-10-01 : 13:44:56
Thanks, there is a lot of information on how to get data from excel to SQL. I was hoping for something as simple as a "Publish" button like the Visual studio team foundation add in has, but it doesn't appear to be that simple.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-10-03 : 02:31:39
Also refer http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -