You could start building pipeline with a look up table in Az. SQL where you have the below structure (or similar to). This table will have the mapping of filename and sheetname to be loaded to tblname
filename,sheetname,tblname
Use a getmetadata activity to dynamically get the file names - note that i have used wildcard in the filename portion of the dataset to get only .xlsx files.
if your source folder has subfolders, you might have to use a filter next to getmetadata activity and use the below expression to filter out folders.
Items: @activity('Get Metadata1').output.childItems
Condition: @equals(item().type,'File')
Next, use a foreach loop poiting to getmetadata activity child items or filter output value (based on if you use a filter)
Inside foreach, have a lookup activity and query the sql table based on the filename being iterated in foreach. Lookup query will look like below,
select * from lookup where filename='@{item().name}'
This will be giving you the sheetname and sink table name corresponding to the file being processed. Output of lookup will be like below
"count": 1,
"value": [
{
"filename": "B.xlsx",
"sheetname": "ADF",
"tblname": "table_b_adf"
}
Lastly, have a copy activity, source will be poiting to a excel dataset as follows.
Source dataset
Here, we have parameterized filename and sheetname as indicated by arrows.
Point to this data set - Excel1 from source tab of copy activty as follows.
Source tab in copy activity
Here, sheetname comes from the lookup output and the filename from the foreach item()
sheetname expression:
@activity('Lookup1_copy1').output.value[0]['sheetname']
Sink settings (mine is synapse dedicated, but would be similar for az sql as well except the copy method) - make sure to click on autocreate table option.
Expression used for table name:
@activity('Lookup1_copy1').output.value[0]['tblname']
Hope this helps for you to get set. Please let us know for queries while trying out.
Thanks