Combine data from multiple google sheets and get tab name

Combining data from multiple Google Sheets be achieved through the script but you can also hard code with QUERY and IMPORTRANGE function in Google Sheets and assign the sheet/tab name within each formula set to get the sheet/tab name along with the data set. As a result, you will one extra column as an assigned tab (Column J in the below sheets example). And also excluded the headers to make the formula simpler.

Combine data from multiple Google Sheets tabs and get sheet/tab name

How to merge several Google sheets tabs into one and get the tab name?

COMBINE DATA FROM MULTIPLE GOOGLE SHEETS TABS — GOOGLE SHEETS FORMULA AND EXAMPLE

=ARRAYFORMULA(QUERY({{IMPORTRANGE("https://docs.google.com/spreadsheets/d/12udQU06rlX7FKPguMHeKf-h6A4Y9dhpS0lqCaD4QcbY/edit","Facebook_Ads!A2:I100"),IMPORTRANGE("https://docs.google.com/spreadsheets/d/12udQU06rlX7FKPguMHeKf-h6A4Y9dhpS0lqCaD4QcbY/edit","Facebook_Ads!Z2:Z100")&"Facebook_Ads"};{IMPORTRANGE("https://docs.google.com/spreadsheets/d/12udQU06rlX7FKPguMHeKf-h6A4Y9dhpS0lqCaD4QcbY/edit","Google_Ads!A2:I100"),IMPORTRANGE("https://docs.google.com/spreadsheets/d/12udQU06rlX7FKPguMHeKf-h6A4Y9dhpS0lqCaD4QcbY/edit","Google_Ads!Z2:Z100")&"Google_Ads"};{IMPORTRANGE("https://docs.google.com/spreadsheets/d/12udQU06rlX7FKPguMHeKf-h6A4Y9dhpS0lqCaD4QcbY/edit","Bing_Ads!A2:I100"),IMPORTRANGE("https://docs.google.com/spreadsheets/d/12udQU06rlX7FKPguMHeKf-h6A4Y9dhpS0lqCaD4QcbY/edit","Bing_Ads!Z2:Z100")&"Bing_Ads"}},"SELECT * WHERE Col1 IS NOT NULL"))

Notes: