• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 312
  • Last Modified:

IMport from Excel into SQL

I am trying to import a spreadsheet into a SQL Table.

I have been trying to do this for 3 days no with no luck. Its beginning to get really frustrating.

By the looks of it the best way is to use linked Servers. I will attach how I have setup the linked server as a picture).

I then use the attached code to do the import and recieve the following error:

" Msg 208, Level 16, State 1, Line 3
Invalid object name 'EXCELLINK'. "

I have run " select * from sys.servers " and it returns that there is a Linked Server called EXCELLINK.

Can anybody suggest anything?

SELECT * INTO sanctionslist FROM EXCELLINK[sanctionslist$]

Open in new window

1 Solution
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel
8.0;DataSource=C:\purchases.xls','SELECT * FROM [sheet1$]')

This is for excel 2003 and a 32 bit SQL Server.

ict-torquilclarkAuthor Commented:
I have run the attached code and have received the following error

Msg 102, Level 15, State 1, Line 4
Incorrect syntax near 'SELECT * FROM [sanctionlist$]'.

The worksheet is definetly called sanctionlist
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel
8.0;DataSource=C:\SANCTIONSLIST.xls','SELECT * FROM [sanctionlist$]'

Open in new window

why don't you create Excel linked server again. just drop existing and create new one with the steps I have mentioned in my article at below link.


I was using Excel 2007, if you are using lesser version, keep your provider to Microsoft.Jet.OLEDB.4.0 rather than Microsoft.ACE.OLEDB.12.0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now