Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Posts
    167

    Unanswered: Importing from excel, but must open the file in excel first?

    While migrating a 32 bit sql server 2000 db to sql server 2008r2 64bit, I've found a strange issue while importing from an excel file: the import fails with Msg 7399 unless I manually open the file in Excel before the import. I'm not changing or saving the file. Just opening and closing it without saving. Afterwards, the import works fine. If I make a copy of the problem sheet before opening, then open the original in Excel and close, I can import the original that I opened in Excel, but not the copy that wasn't.

    I'm reluctant to inform the uploading client that their files are haunted, especially since this was working fine on the 32 bit server. The only thing that has changed is that I've changed the data provider form the 32 bit JET to the 64 bit ACE. In the 32 bit environment, I can import that previously unopenable copy without a problem. I'm not sure if it's related, but the Jet import is also 5 times faster than the 64 bit ace import (after I've opened & closed the file in excel). One other detail: after I've imported in the 32 bit environment, I can then import in the 64 bit environment without an issue - even though the file hasn't changed.

    Has anyone heard of such a strange glitch, and is there a workaround that doesn't require manually opening the file?

    Here is an example of the statement that doesn't work until I've opened & closed the file in Excel:

    Code:
    select	F1,F2,F3,F4,F5,F6,F7,F8
    from	opendatasource
          	('Microsoft.ACE.OLEDB.12.0','Data Source="\\server\sites\incoming\problemFile - Copy.xls";
          	User ID=Admin;Password=;
          	Extended Properties="Excel 8.0;HDR=No;IMEX=1"'
          	)...['First Sheet$'] x
    Last edited by onansalad; 02-18-16 at 11:45. Reason: additional detail
    Kit Lemmonds

  2. #2
    Join Date
    Nov 2003
    Posts
    167
    Additonal info: I've compared the file before opening in excel and after opening in excel with a hex editor, and it appears that excel is changing text in the first line @ position 559 from "Java Excel APIv2.5.7" to "Kit Lemmondsv2.5.7" which is the name of the workgroup user registered in Excel. I suspect that this position is used by excel to tell if the file is exclusively opened by another user. I'm unsure why the 32 bit JET provider had no problem with the original unopened file but the 64 bit ACE provider does.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •