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
 Table to Excel Spreadsheet

Author  Topic 

tdwainet
Starting Member

5 Posts

Posted - 2011-04-01 : 10:56:28
I want to take an entire SQL table within SQL Server Management Studio Code and place it in an already existing xls file starting in cell A10 with headings and all and save the data there. The tab that I need to place the data in is call Inventory.

I realize that I probably need to use the OPENROWSET command; however, I'm having difficulty accomplishing this task. Could someone please assist me ? Thank you.

I'm using the following code:
INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=E:\user_profiles\todd\QB POS Import Template.xls',
'SELECT * FROM [Inventory$]') SELECT * FROM QB_POS_Store2

However I'm getting the following error:
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "The Microsoft Jet database engine could not find the object 'Inventory$'. Make sure the object exists and that you spell its name and the path name correctly.".
Msg 7350, Level 16, State 2, Line 1
Cannot get the column information from OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".

---- The Sheet name is Inventory and the path and file name are correct. I also need to insert this table beginning in cell A10.

---- I get the same error message.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-04-01 : 11:07:34
Follow this http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926
What is the difficulty?

Madhivanan

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

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-04-01 : 11:18:31
Make sure that the sheet name is spelled correctly

Madhivanan

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

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-04-01 : 11:27:55
Make sure the first row in the sheet has column names

Madhivanan

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

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-04-01 : 12:04:07
Please do not edit the post. Post your reply newly. It is difficult to follow if you keep on editing the post

Madhivanan

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

tdwainet
Starting Member

5 Posts

Posted - 2011-04-01 : 12:06:55
quote:
Originally posted by tdwainet

I want to take an entire SQL table within SQL Server Management Studio Code and place it in an already existing xls file starting in cell A10 with headings and all and save the data there. The tab that I need to place the data in is call Inventory.

I realize that I probably need to use the OPENROWSET command; however, I'm having difficulty accomplishing this task. Could someone please assist me ? Thank you.

I'm using the following code:
INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=E:\user_profiles\todd\QB POS Import Template.xls',
'SELECT * FROM [Inventory$]') SELECT * FROM QB_POS_Store2

However I'm getting the following error:
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "The Microsoft Jet database engine could not find the object 'Inventory$'. Make sure the object exists and that you spell its name and the path name correctly.".
Msg 7350, Level 16, State 2, Line 1
Cannot get the column information from OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".

---- The Sheet name is Inventory and the path and file name are correct. I also need to insert this table beginning in cell A10.

---- I get the same error message.

Ok. No Problem. I'm new to this.

Go to Top of Page

tdwainet
Starting Member

5 Posts

Posted - 2011-04-01 : 12:07:25
quote:
Originally posted by tdwainet

I want to take an entire SQL table within SQL Server Management Studio Code and place it in an already existing xls file starting in cell A10 with headings and all and save the data there. The tab that I need to place the data in is call Inventory.

I realize that I probably need to use the OPENROWSET command; however, I'm having difficulty accomplishing this task. Could someone please assist me ? Thank you.

I'm using the following code:
INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=E:\user_profiles\todd\QB POS Import Template.xls',
'SELECT * FROM [Inventory$]') SELECT * FROM QB_POS_Store2

However I'm getting the following error:
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "The Microsoft Jet database engine could not find the object 'Inventory$'. Make sure the object exists and that you spell its name and the path name correctly.".
Msg 7350, Level 16, State 2, Line 1
Cannot get the column information from OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".

---- The Sheet name is Inventory and the path and file name are correct. I also need to insert this table beginning in cell A10.

---- I get the same error message.

Ok. No Problem. I'm new to this.

Go to Top of Page
   

- Advertisement -