I have a ton of excel files which I'm trying to import to SQL Server from the backend and then automate it using a batch file.
I know that we can use OPENROWSET inside a T-sql script and load the excel files. I'm also aware of using SQLCMD or BCP options. All of these will work for excel sheets which are straightforward grids.
However, the challenge is, I only need to load a specific region/range of excel cells from a sheet. For example: if the sheet has the below info, I need to only load the below columns:
Date, Group1, Group2 and Group 3
until it hits the "Blank Row" and ignore everything below it.
Date Group1 Group2 Group 3
Jan-13 25 26 27
Jan 18 35 29 19
20 15
<empty row> <empty row>
Y/Y % YTD % Group %
15 20 40
So, my question is: is it possible to implement this functionality using OPENROWSET in T-SQL? IF so, can you please point me to any links/example on how I can do this? I tried digging around a bit on the MSDN site but couldn't find any.
If this cannot be done in T-SQL, any ideas on how I could implement it from the backend?
Thanks in advance, Bee