Help troubleshooting data import from Excel into existing table

  • Hi everybody,

    I am trying to load data from and excel 2000 file into its respective table, but I get the following error: "[OLE/DB provider returned message: The Microsoft Jet database engine could not find the object 'Sheet1$'. Make sure the object exists and that you spell its name and the path name correctly.]"

    Here's the T-SQL

    Insert Into MyTable

    SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',

    'Excel 8.0;Database=C:\BlankDB.xls', 'SELECT * FROM [Sheet1$]')

    The fiel, and the sheet do exist, I have tried changing sheet's name, but get the same error.

    Can anybody advise?

    Thanks.

  • Insert Into MyTable

    SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',

    'Excel 8.0;Database=C:\BlankDB.xls', Sheet1$)

  • chek the link, and modify it: http://www.mssqltips.com/tip.asp?tip=1202.

  • Thanks. I'll look into it.

  • The single quotes around the sheet name are part of the name, for example:

    FROM [DEFS]...['Table Download$']

    You will see that if you chose "Script table as/SELECT to/New Query Editor Window" after right clicking on the table (tab) name for the Linked Server.

  • mutekinohito (11/10/2008)


    Hi everybody,

    I am trying to load data from and excel 2000 file into its respective table, but I get the following error: "[OLE/DB provider returned message: The Microsoft Jet database engine could not find the object 'Sheet1$'. Make sure the object exists and that you spell its name and the path name correctly.]"

    Here's the T-SQL

    Insert Into MyTable

    SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',

    'Excel 8.0;Database=C:\BlankDB.xls', 'SELECT * FROM [Sheet1$]')

    The fiel, and the sheet do exist, I have tried changing sheet's name, but get the same error.

    Can anybody advise?

    Thanks.

    More informations

    http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926


    Madhivanan

    Failing to plan is Planning to fail

  • I see you're using the normal denotation c:\...

    This means your file is in the root directory of the C drive of the SQL server machine, and the userid used to start the SQL server instance must have read access to that file. If the file is on the machine where you run your query analyzer, your filename should be like '\\machine\sharename\blankDB.xls'

    I hope this is of assistance !

  • Thans, I was indeed using a remote machine to run the script. It worked just fine when I did it inthe server itself.

    I'll try again from my machine using your suggestion.

    Again, thank you very much. You guys do know your stuff 🙂

    Alex.

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply