I have a spreadsheet in Google Sheets, where I am currently running a script.
There are two tabs, the first tab is the following:
The second tab is the following:
This is the script I am running:
function result(range) { var output2 = []; for(var i=0, iLen=range.length; i<iLen; i++) { var s = range[i][6].split(", "); var t = range[i][7].split(", "); var u = range[i][8].split(", "); for(var j=0, jLen=s.length; j<jLen; j++) { var output1 = []; for(var k=0, kLen=range[0].length; k<kLen; k++) { if(k == 6) { output1.push(s[j]); } else if(k == 7) { output1.push(t[j]); } else if(k == 8) { output1.push(u[j]); } else { output1.push(range[i][k]); } } output2.push(output1); } } return output2;}
In the second tab on the spreadsheet, in cell A1 I have the following function:
=result(Data!A1:AA)
What I am trying to get out of the script is that the names listed in Columns G-I (in the first tab) split where there is a comma and all the surrounding data is kept the same.
As you can see in the second tab it only splits the names in column G, but column H & I it only keeps the first attendee.
Is there a way to modify the script to get it to split all attendees in columns G-I?