I need a little help with my script.
First, here is a link to the ss: https://docs.google.com/spreadsheets/d/1TgG64irjoxkV9wKlT5bEnaNEWlGyOlNxVoLxOmQZ2BA/edit?usp=sharin
I believe your goal as follows.
Team 1
by comparing the cells "C4:C12" in the sheet Overview
with the cells "A2:A28" in the sheet Team 1
.For this, how about this modification?
v2
is compared with all values of v1
in the loop, the process cost will be high. So at first, it creates an object for searching the values, and the search is run using the object.When your script is modified, it becomes as follows.
for (var i = v2.length - 1; i >= 0; i--)
if (v2[i][0] == v1)
s2.deleteRow(i + 2);
To:
var obj = v1.reduce((o, [e]) => (Object.assign(o, {[e]: true})), {});
for (var i = v2.length - 1; i >= 0; i--)
if (obj[v2[i][0]])
s2.deleteRow(i + 2);