Reputation: 2183
I am creating a SSIS package in which i have to move data from Excel to a table in SQL server. Excel file is like Source Assistant in data flow task.
Number columns in Excel file won't change but column names will change dynamically.
For example, In 2017 excel will look like this:
SId Name Jan2017 Feb2017
1 name1 10 20
2 name2 30 40
in 2018, it will look like this:
SId Name Jan2018 Feb2018
1 name1 50 60
2 name2 70 80
Once in every year I will run this Job to move the data from excel to DB. I have to movie this kind of data in to a table which have columns like below.
When i run this Job in 2017, data should be filled like below.
SId Name Jan Feb
1 name1 10 20
2 name2 30 40
When i run this Job in 2018, data should be filled like below.
SId Name Jan Feb
1 name1 50 60
2 name2 70 80
How can i handle this kind of data.
Upvotes: 2
Views: 1847
Reputation: 37313
Alias column names in the Excel Source -> Columns
F1 F2 F3 F4
SId Name Jan Feb
You can follow my answer at Importing excel files having variable headers it is solving a very similar case.
Upvotes: 2