I made a test file, and ran through the excel file just fine, but whe nI insert one with a lot of data, I get the following error:
The Microsoft Office Access database engine could not find the object 'Sheet1$'
Which seems incredibly obvious, but ‘Sheet1’ is surely there, just like in my test file – I have checked about 30 times. There is only data on the first Sheet and it is clearly named ‘Sheet1’ like the default. Any idea why I would still be getting this error?
code:
string path = Server.MapPath('~') + '\\attachments\\ejmaps\\ejmaps.xlsx'; string connString = string.Format('Provider=Microsoft.ACE.OLEDB.12.0;Data Source=' + path + ';Extended Properties=\'Excel 12.0 Xml;HDR=YES\';'); OleDbDataAdapter adapter = new OleDbDataAdapter('SELECT * FROM [Sheet1$]', connString);
odd… I had changed the name back to what it was originally (EJMaps Pull.xlsx) and it worked?
Any ideas why that would be?