Is anyone able to help me? I have a spreadsheet which includes a sheet with list of URL's of files in my google drive. Now I need to move the data from another spreadsheet to these files considering that the data is mixed and I need a loop to check the cell value against file name. Hours of googling did not give me any idea.
Perhaps this will help
function moveDatatolistoffileurls() {
const ss = SpreadsheetApp.getActive();
const sh = ss.getSheetByName("Your Sheet Name");
const [hA, ...vs] = sh.getDataRange().getValues();//assume one header row
let col = {};
hA.forEach((h, i) => { col[h] = i + 1; })
vs.forEach((r, i) => {
let s = SpreadsheetApp.openByUrl(r[col["url header string"]]);
if(s.getName() == r[col["file name header"]]) {
s.getSheet()[0].appendRow(r);
}
})
}
If you want a better answer then ask a better question.