I have excel files that follow the same table structure, but varying file names and sheetnames (usually due to dates). I can not use script task. I have succesfully followed the top example here that loads files despite sheetname and file name. However, I encountered a new error, the example works when the column names are in the first row, but when they all start in a different row, thus requiring a sql command from variable, the example does not work.
The variable I use is "SELECT * FROM [" + @[User::SheetName] +"A9:AB99999]" which equates to SELECT * FROM [Bdx-Nov$A9:AB999999]. I follow every step from example exactly, but when using this variable opposed to just sheetname variable package returns following error:
An OLE DB record is available. Source: "Microsoft Access Database Engine" Hresult: 0x80004005 Description: "The Microsoft Access database engine could not find the object ''Bdx-Nov$'A9:AB99999'. Make sure the object exists and that you spell its name and the path name correctly. If ''Bdx-Nov$'A9:AB99999' is not a local object, check your network connection or contact the server administrator.". Error: 0xC020204A at Data Flow Task - Load File, Excel Source [14]: Unable to retrieve column information from the data source. Make sure your target table in the database is available.
But previewing with the sql command variable does work, any insight to resolve this?