4

I created xlsx file using standarts of Open Xml SDK. While opening it in excel everything works perfect. My problem is that I cannot open that created file using OleDbConnection, but others not created xlsx file OleDB can open as well.

Will be glad for any help.

  • Could you show your connection string? Did you have the excel file open when your code fails? – Steve Apr 03 '15 at 07:49
  • My Connection String: var connection = new OleDbConnection("provider=Microsoft.ACE.OLEDB.12.0;data source=" + xlsFilePath + ";Extended Properties=\"Excel 12.0 Xml;HDR=YES;IMEX=1\""); – Solomiia Kalinchuk Apr 03 '15 at 08:12
  • I do not have excel, I am using to check if file works excel from google drive. – Solomiia Kalinchuk Apr 03 '15 at 08:13
  • Well, the connection string seems to be ok. Did you get any exception when trying to open the connection? Something triggers an error message when you try to read the data? – Steve Apr 03 '15 at 08:57
  • The message was :External table is not in the expected format. But currently I am trying to read data programatically using open xml sdk and it is looks that cell value is not set correctly. For excel that was saved by excel program, there is CellValue, but I have only InlineString.(In my document CellValue is always null and in excel generated file, InlineString is null). I guess it is a main problem. – Solomiia Kalinchuk Apr 03 '15 at 09:02
  • Same issue here. I’m writing my own spreadsheet using Open XML SDK but, when I upload to my import tool, OLE DB connection fails with “External table is not in the expected format.” If I open the file in Excel then save (without making any actual content changes), the import OLE DB connection succeeds. – Lobstrosity Jul 21 '15 at 17:13
  • Also, I tested my generated spreadsheet with Open XML SDK Productivity Tool and there are no validation errors. (I thought that maybe there was an issue that Excel was working around when it opened it that OLE DB was not.) – Lobstrosity Jul 21 '15 at 17:16
  • In my case, I just read my spreadsheet with Open Xml SDK tool and it works. By the way if you will go my way, read about SharedStringTable (all data that opened with Excel write string data using that table). Hope it help you. – Solomiia Kalinchuk Jul 23 '15 at 14:21
  • I wonder if any one, ever, was able to create .xlsx file with Open XML and then read this using OLEDB?? – Sebastian Widz Nov 12 '19 at 09:23

0 Answers0