I have 2 spreadsheets for 2 employees and I combine them into 1.
From employee 1:
From employee 2:
I use importrange to combine the sheets. I also know now how to get the spreadsheet file name by using this google-apps-script code.
/**
* Gets the Sheet Name of a selected Sheet.
*
* @param {number} option 0 - Current Sheet, 1 All Sheets, 2 Spreadsheet filename
* @return The input multiplied by 2.
* @customfunction
*/
function SHEETNAME(option) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet()
var thisSheet = sheet.getName();
//Current option Sheet Name
if(option === 0){
return thisSheet;
//All Sheet Names in Spreadsheet
}else if(option === 1){
var sheetList = [];
ss.getSheets().forEach(function(val){
sheetList.push(val.getName())
});
return sheetList;
//The Spreadsheet File Name
}else if(option === 2){
return ss.getName();
//Error
}else{
return "#N/A";
};
};
I want to automatically fill the column QA NAME with the source spreadsheet name: