How to link Excel 2010 .XLSX file to SQL server 2008R2 - a method that actually works?

I have been trying unsuccessfully to link my excel file to SQL server like I used to with SQL 2005.
In SQL 2008R2 I have installed the 64-bit data access components from Office 2010 to get the  provider 'Microsoft.ACE.OLEDB.12.0' avilable.
When I try this command:
SELECT
FROM
OPENDATASOURCE(
'Microsoft.ACE.OLEDB.12.0',
'Data Source="E:\ADUpdates\Employee List1.xlsx"; Extended properties=Excel 12.0')...[Sheet1$]
I get this error:
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" reported an error. Access denied.
Msg 7301, Level 16, State 2, Line 1
Cannot obtain the required interface ("IID_IDBCreateCommand") from OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".
The Access Denied error seems to be form the worksheet and not the file itself. Evidence is that if I enter a bogus sheet name it tells me the sheet doesn't exist and after this error the file is locked open and can't be saved again from Excel until the
query windows is closed. The sheet is not protected in Excel so I don't know how access to it can be denied.
Does anyone actually have this working in SQL 2008R2?

Some minor progress on this issue by running SQL Server service under a domain account with Administrator priv on the SQL server.
This query now works in a query window:
SELECT * FROM OPENDATASOURCE( 'Microsoft.ACE.OLEDB.12.0', 'Data Source="E:\ADUpdates\Employee List.xlsx"; Extended properties=Excel 12.0')...[EmployeeData];
However, creating a Linked server object for the same spreadsheet still does not work:
EXEC master.dbo.sp_addlinkedserver @server = N'TEST', @srvproduct=N'Excel 12.0', @provider=N'Microsoft.ACE.OLEDB.12.0', @datasrc=N'E:\ADUpdates\Employee List.xlsx'
The test connection to the linked server failed.
Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "TEST".
OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "TEST" returned message "Unrecognized database format 'E:\ADUpdates\Employee List.xlsx'.". (Microsoft SQL Server, Error: 7303)
For help, click:
http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600&EvtSrc=MSSQLServer&EvtID=7303&LinkId=20476
Naturally, the help link provided only confirms the contempt microsoft holds for their customers by not providing any information at all.
(appologies for the weird colour and fonts, this is a microsoft product, just have to live with obvious defects).

Similar Messages

  • How to recover deleted attached mdf file from sql server management studio

    Hi everyone
    I've faced very bad problem
    I had a mdf file that created in visual studio, and then I had attached this file to sql server management studio and after that, when I wanted to deattach
    this file I had a big mistake; and deleted the mdf file; then now this file was deleted from my computer
    I test several recovery tools but they can't find deleted mdf file; the volume of the mdf file was more than 2 GB.
    Please help me if you can

    Hello,
    If you don't have a backup of the database, then it's not really possible to get it back. There are some "Undelete" Tools available for Windows, but when even only one page was overwritten on disk, then it's not possible to recover it.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Can't import office 2010/13 files into SQL Server. I'm out of ideas!

    Hi
    I have SQL Server 2012 installed on my Windows 8.1 Instance.  I want to be able to import and export data to Access 2013 files *accdb.  I have Office 64 bit installed on my machine.  I have searched a lot and can't find exactly what to do
    to fix this.  I have even done a clean install of SQL, but still no bananas.
    I have downloaded and installed Microsoft Access Database Engine 2010 but that didn't help.
    Any ideas?

    OK, now I know why I have never solved this problem.  When I try to install Microsoft Access
    Database Engine 2010 32 bit version, I get an error saying I cannot install the 32 bit version while running Office 2013 64 bit.  
    I found this blog http://knowledge.autodesk.com/support/autocad-civil-3d/troubleshooting/caas/sfdcarticles/sfdcarticles/How-to-install-64-bit-Microsoft-Database-Drivers-alongside-32-bit-Microsoft-Office.html
    which talks about the opposite problem, but not my problem.  Does anyone know of a work around to install the 32bit version of ADE with 64 bit Office?

  • Issue importing flat files into SQL server 2008R2

    I have csv files that the last column may not have data. SSIS (version 2008R2) will insert the next row's data into the empty cells, which causes my package to fail.
    I know this is resolved in 2012 but we are using 2008R2 still. Any suggestions?
    Thanks.

    Hi sqlBI2014,
    After testing the issue that Flat File Connection Manager cannot handle file with uneven number of columns in each row in my SQL Server 2008 R2 environment, I can reproduce it.
    Based on my research, the issue is caused by the Column Delimiter gets first preference and then Row delimiter. So the next row data would be inserted in the empty column cell. This is by design in SQL Server 2005, SQL Server 2008 or SQL Server 2008 R2.
    Good news is that the issue is fixed in SQL Server Data Tools which comes with SQL Server 2012. In SQL Server 2012, by default, the Flat File Connection Manager always checks for a row delimiter in unquoted data, and starts a new row when a row delimiter
    is found. This enables the connection manager to correctly parse files with rows that are missing column fields.
    If you still want to fix the issue in SQL Server 2008 R2, there is a sample component posted to the CodePlex that might help you with this:
    http://ssisdfs.codeplex.com/
    References:
    http://blogs.msdn.com/b/dataaccesstechnologies/archive/2013/03/13/flat-file-source-cannot-handle-file-with-uneven-number-of-columns-in-each-row.aspx
    https://connect.microsoft.com/SQLServer/feedback/details/293193/ssis-import-of-flat-file-with-uneven-number-of-columns
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How can I load a .xlsx File into a SQL Server Table using a Foreach Loop Container in SSIS?

    I know I've REALLY struggled with this before. I just don't understand why this has to be soooooo difficult.
    I can very easily do a straight Data Pump of a .xlsX File into a SQL Server Table using a normal Excel Connection and a normal Excel Source...simply converting Unicode to DT_STR and then using an OLE DB Destination of the SQL Server Table.
    If I want to make the SSIS Package a little more flexible by allowing multiple .xlsX spreadsheets to be pumped in by using a Foreach Loop Container, the whole SSIS Package seems to go to hell in a hand basket. I simply do the following...
    Put the Data Flow Task within the Foreach Loop Container
    Add the Variable Mapping Variable User::FilePath that I defined as a Variable and a string within the FOreach Loop Container
    I change the Excel Connection and its Expression to be ExcelFilePath ==> @[User::FilePath]
    I then try and change the Excel Source and its Data Access Mode to Table Name or view name variable and provide the Variable Name User::FilePath
    And that's when I run into trouble...
    Exception from HRESULT: 0xC02020E8
    Error at Data Flow Task [Excel Source [56]]:SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occured. Error code: 0x80004005.
    Error at Data Flow Task [Excel Source [56]]: Opening a rowset for "...(the EXACT Path and .xlsx File Name)...". Check that the object exists in the database. (And I know it's there!!!)
    I don't understand by adding a Foreach Loop Container to try and make this as efficient as possible has caused such an error unless I'm overlooking something. I have even tried delaying my validations and that doesn't seem to help.
    I have looked hard in Google and even YouTube to try and find a solution for this but for the life of me I cannot seem to find anything on pumping a .xlsX file into SQL Server using a Foreach Loop Container.
    Can ANYONE please help me out here? I'm at the end of my rope trying to get this to work. I think the last time I was in this quandry, trying to pump a .xlsX File into a SQL Server Table using a Foreach Loop Container in SSIS, I actually wrote a C# Script
    to write the contents of the .xlsX File into a .csv File and then Actually used the .csv File to pump the data into a SQL Server Table.
    Thanks for your review and am hoping and praying for a reply and solution.

    Hi ITBobbyP,
    If I understand correctly, you want to load data from multiple sheets in an .xlsx file into a SQL Server table.
    If in this scenario, please refer to the following tips:
    The Foreach Loop container should be configured as shown below:
    Enumerator: Foreach ADO.NET Schema Rowset Enumerator
    Connection String: The OLE DB Connection String for the excel file.
    Schema: Tables.
    In the Variable Mapping, map the variable to Sheet_Name, and change the Index from 0 to 2.
    The connection string for Excel Connection Manager is the original one, we needn’t make any change.
    Change Table Name or View name to the variable Sheet_Name.
    If you want to load data from multiple sheets in multiple .xlsx files into a SQL Server table, please refer to following thread:
    http://stackoverflow.com/questions/7411741/how-to-loop-through-excel-files-and-load-them-into-a-database-using-ssis-package
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Data Pump .xlsx into a SQL Server Table and the whole 32-Bit, 64-Bit discussion

    First of all...I have a headache!
    Found LOTS of Google hits when trying to data pump a .xlsx File into a SQL Server Table. And the whole discussion of the Microsoft ACE 64-Bit Driver or the Microsoft Jet 32-Bit Driver.
    Specifically receiving this error...
    An OLE DB record is available.  Source: "Microsoft Office Access Database Engine"  Hresult: 0x80004005  Description: "External table is not in the expected format.".
    Error: 0xC020801C at Data Flow Task to Load Alere Coaching Enrolled, Excel Source [56]: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "Excel Connection Manager"
    failed with error code 0xC0202009.
    Strangely enough, if I simply data pump ONE .xlsx File into a SQL Server Table utilizing my SSIS Package, it seems to work fine. If instead I am trying to be pro-active and allowing for multiple .xlsx Files by using a Foreach Loop Container and a variable
    @[User::FileName], it's erroring out...but not really because it is indeed storing the rows onto the SQL Server Table. I did check all my Delay
    Why does this have to be sooooooo difficult???
    Can anyone help me out here in trying to set-up a SSIS Package in a rather constrictive environment to pump a .xlsx File into a SQL Server Table? What in God's name am I doing wrong? Or is all this a misnomer? But if it's working how do I disable the error
    so that is stops erroring out?

    Hi ITBobbyP,
    According to your description, when you import data of .xlsx file to SQL Server database, you got the error message.
    The error can be caused by the following reasons:
    The excel file is locked by other processes. Please kindly resave this file and name it to other file name to see if the issue will be fixed.
    The ACE(Access Database Engine) is not up to date as Vaibhav mentioned. Please download the latest ACE and install it from the link:
    https://www.microsoft.com/en-us/download/details.aspx?id=13255.
    The version of OFFICE and server bitness is not the same. To solve the problem, please refer to the following document:
    http://hrvoje.piasevoli.com/2010/09/01/importing-data-from-64-bit-excel-in-ssis/
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

  • Importing excel file to SQL Server

    I have an application that needs to import an excel file with
    10 columns of data into an SQL Server database table with 13
    columns of data. Two of the 3 extra database columns are manditory,
    and I need to manipulate the values going in.
    I've determined the best method to do this using coldfusion
    is to import the excel file into a cvs file then use SQL to import
    the cvs file into SQL server. Does anyone know how to import an
    excel document into a cvs file using ColdFusion?
    Thanks!

    A couple of things come to mind. You might consider using DTS
    to import your data directly into SQL Server from Excel, rather
    than putting ColdFusion in the middle. Or, you might consider
    creating a ColdFusion ODBC datasource out of your Excel file, use a
    cfquery to select the applicable data, then insert the data into
    SQL Server in a loop. Not very efficient, but it can be done.
    Phil

  • How to attach .mdf file to sql server 2008 EXPRESS

    I have .mdf files created using SQL SERVER management studio 2012 in another computer and wish to attach the same to SQL SERVER 2008 EXPRESS in another computer. How should I do so? I tried this method :How
    to: Attach a Database File to SQL Server Express but then it shows an error that the database cannot be created due to compatibility issues.
    Msg 948: The database xyz cannot be opened because it is version 706. This server supports version 655 and earlier. A downward path is not supported..
    Any help??

    I have .mdf files created using SQL SERVER management studio 2012 in another computer and wish to attach the same to SQL SERVER 2008 EXPRESS in another computer. How should I do so? I tried this method :How
    to: Attach a Database File to SQL Server Express but then it shows an error that the database cannot be created due to compatibility issues.
    Msg 948: The database xyz cannot be opened because it is version 706. This server supports version 655 and earlier. A downward path is not supported..
    Any help??
    You are trying to attach SQL Server 2012  database files to SQL Server 2008 R2 which is not allowed, you either need to upgrade your SQL Server 2008 to 2012 or alternatively you can generate all scripts from SQL Server 2012 and execute it in SQL Server
    2008 R2.
    You can refer below link to how to generate script.
    http://blog.sqlauthority.com/2012/07/18/sql-server-generate-script-for-schema-and-data-sql-in-sixty-seconds-021-video/
    Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
    Praveen Dsa | MCITP - Database Administrator 2008 |
    My Blog | My Page

  • How can open a html, pdf files from the server (c:\foldername\filename)

    Hi all,
    I am developing an application. in this app i have to implement RMI.
    My problem is this, How can a client open a files from the server.
    all the html, pdf files are stored in the server's directory like C:\audit\filename.
    There is a folder on the server's C directory which contains all the html , pdf files.
    please tell me how can a client open a file from the server using RMI.
    Please send me the solution as soon as possible.
    Thanks & Regards
    Bhavishya

    That's doing it the hard way. Why not use HTTP or FTP?

  • How to open sdf files in SQL server 2012?

    How to open sdf files in SQL server 2012?
     I couldn’t figure out how to open the sdf files in SQL server 2012
     Thank you
     Best
     Jamal

    I don't think it's hard if understood the question properly you can try this I do it most of the time and this might be the solution for you, sometimes minor simple click is a life saver:)
    1. 
    Open SQL Server Management Studio, or if it's running select File -> Connect Object Explorer... and click the
    connect drop down arrow
    2. 
    In the Connect to Server dialog you will see Database Enghine, Analaysis Servie on so on and you go head change Server type to
    SQL Server Compact Edition
    3. 
    From the Database file drop-down as shown below click the drop down arrow and select <
    Browse for more...>
    4. 
    And you will see C:\, D:\, G:\
    drive and so on and open, your SDF file where it is located
    I hope this has been informative for you and good luck
    Please remember to click “Mark as Answer” on the post that has answered your question as it is very relevant to other community members dealing with same problem in seeking the right answer

  • How to create a DSN-less connection to SQL Server for linked tables in Access

    hey
    i cant understand how i use that Function
    if that information what you need
     stLocalTableName: dbo_user_name
    stRemoteTableName: user_name
    stServer :sedo2015.mssql.somee.com
    stDatabase :sedo2015
    stUsername :sedo_menf_SQLLogin_1
    stPassword :123456789
    how will be that Function??
    please write that Function to me
    '//Name : AttachDSNLessTable
    '//Purpose : Create a linked table to SQL Server without using a DSN
    '//Parameters
    '// stLocalTableName: Name of the table that you are creating in the current database
    '// stRemoteTableName: Name of the table that you are linking to on the SQL Server database
    '// stServer: Name of the SQL Server that you are linking to
    '// stDatabase: Name of the SQL Server database that you are linking to
    '// stUsername: Name of the SQL Server user who can connect to SQL Server, leave blank to use a Trusted Connection
    '// stPassword: SQL Server user password
    Function AttachDSNLessTable(stLocalTableName As String, stRemoteTableName As String, stServer As String, stDatabase As String, Optional stUsername As String, Optional stPassword As String)
    On Error GoTo AttachDSNLessTable_Err
    Dim td As TableDef
    Dim stConnect As String
    For Each td In CurrentDb.TableDefs
    If td.Name = stLocalTableName Then
    CurrentDb.TableDefs.Delete stLocalTableName
    End If
    Next
    If Len(stUsername) = 0 Then
    '//Use trusted authentication if stUsername is not supplied.
    stConnect = "ODBC;DRIVER=SQL Server;SERVER=" & stServer & ";DATABASE=" & stDatabase & ";Trusted_Connection=Yes"
    Else
    '//WARNING: This will save the username and the password with the linked table information.
    stConnect = "ODBC;DRIVER=SQL Server;SERVER=" & stServer & ";DATABASE=" & stDatabase & ";UID=" & stUsername & ";PWD=" & stPassword
    End If
    Set td = CurrentDb.CreateTableDef(stLocalTableName, dbAttachSavePWD, stRemoteTableName, stConnect)
    CurrentDb.TableDefs.Append td
    AttachDSNLessTable = True
    Exit Function
    AttachDSNLessTable_Err:
    AttachDSNLessTable = False
    MsgBox "AttachDSNLessTable encountered an unexpected error: " & Err.Description
    End Function

    thanks more thanks for you
    look i add that code in form
    it worked but i cant add recored  why ??
    Private Sub Form_Open(Cancel As Integer)
    Call AttachDSNLessTable("dbo_user_name", "user_name", "sedo2015.mssql.somee.com", "sedo2015", "sedo_menf_SQLLogin_1", "123456789")
    End Sub

  • How could I create a "Linked Server" link from SQL Server 2008R2 64-Bit to Oracle Database 11.2 64-Bit?

    How could I create a "Linked Server" link from SQL Server 2008R2 64-Bit to Oracle Database 11.2 64-Bit?
    Let's say the SQL Server and Oracle Database are in the same Company Internet Network.
    I have the code, but I do not know how to use it. Such as what is System DSN Name? Where could I get it. What does it look like?
    Do I need to install any Oracle Client Software in order to link from SQL Server to Oracle? Or SQL Server has the built-in drivers installed already that I can directly create a Linked Server from SQL Server to Oracle?
    I need to know details. Thanks.
    USE master
    go
    EXEC sp_addlinkedserver
         @server  = '{Linked Server Name}'
        ,@srvproduct = '{System DSN Name}'
        ,@provider  = 'MSDASQL'
        ,@datasrc  = '{System DSN Name}'
    EXEC sp_addlinkedsrvlogin
         @rmtsrvname = '{Linked Server Name}'
        ,@useself  = 'False'
        ,@locallogin = NULL
        ,@rmtuser  = '{Oracle User Name}'
        ,@rmtpassword = '{Oracle User Password}'

    You need an OLE DB provider for Oracle. There is one that ships with Windows, but it only supports very old versions of Oracle. Oracle has an OLE DB provider that you can use. I don't know if it's part of Oracle Client or how it is bundled.
    You should not use MSDASQL or any DSN.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • How to save image files into SQL Server?

    Hello, All:
    Does anyone know how to save image files into SQL Server? Does the file type have to be changed first?? Please help me! Thank you!

    You need a BLOB field (usually)... Then you can check this tutorial out:
    http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/exercises/BLOBPut/
    There are other exercises on that site, including one on reading the images back.

  • How can i upload a video file to wiki server through iPad?

    how can i upload a video file to wiki server through iPad?

    You might want to post this in the iPad Forum

  • How to Provide search Help for files on Application Server

    Hi Guys,
                   Can anyone tell me How to Provide search Help for files on Application Server. I have put a file name on selection screen. I want to give search help for files on application server.
    Thanks & Regards.
    Harish.

    Hi Harish,
    Use the following code,
    tables sxpgcotabe.
    data: lt_execprot LIKE btcxpm OCCURS 0 WITH HEADER LINE,
            w_filepath(60)       TYPE c, --> length depending on your Directory path.
      SELECT SINGLE *
        FROM sxpgcotabe
             WHERE name = 'LIST_DB2DUMP'
               AND opsystem = sy-opsys.
      IF sy-subrc <> 0.
        SELECT SINGLE *
          FROM sxpgcotabe
               WHERE name = 'LIST_DB2DUMP'
                 AND opsystem = 'UNIX'.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'External operating system command '
                            'LIST_DB2DUMP not found'.
        ENDIF.
      ENDIF.
      sxpgcotabe-parameters = p_filepath. --> provide the directory path.
      CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
           EXPORTING
                commandname                   = sxpgcotabe-name
                additional_parameters         = sxpgcotabe-parameters
                operatingsystem               = sxpgcotabe-opsystem
           TABLES
                exec_protocol                 = lt_execprot 
           EXCEPTIONS
                no_permission                 = 1
                command_not_found             = 2
                parameters_too_long           = 3
                security_risk                 = 4
                wrong_check_call_interface    = 5
                program_start_error           = 6
                program_termination_error     = 7
                x_error                       = 8
                parameter_expected            = 9
                too_many_parameters           = 10
                illegal_command               = 11
                wrong_asynchronous_parameters = 12
                cant_enq_tbtco_entry          = 13
                jobcount_generation_error     = 14
                OTHERS                        = 15.
      IF sy-subrc <> 0.
        MESSAGE e000 WITH text-e01 p_filepath.  "Directory failed
      ENDIF.
    Loop round the directory list, split each line up into a line table
    and get the last data for each line, should be the filename
    Then build the dirlist.
      REFRESH t_dirlist.
      LOOP AT lt_execprot.
        REFRESH t_dirline.
        SPLIT lt_execprot-message AT space INTO TABLE t_dirline.
        DESCRIBE TABLE t_dirline LINES w_nolines.
        READ TABLE t_dirline INDEX w_nolines.
        MOVE t_dirline-data TO t_dirlist-filename.
        APPEND t_dirlist.
      ENDLOOP.
    Here you will get all the files in the directory mentioned in Application server.
    For displaying them as a Search help use the FM '/BMC/ZPOPUP_GET_VALUE'
    Pass the Internal table to this FM.
    Regards,
    Paul.

Maybe you are looking for