The spreadsheet has some cells with cell contents that are separated by commas, or a new line.
123, 876, 456
Column "C" is the column that determines whether a row should be split up into multiple rows.
Information from the Form goes into the "Form Submission" page.
We have a specific format that we must meet to submit to our report tracking software that requires the issue numbers (found in Column C) to be separated into their own rows with the information found in Columns A:B, D:J remaining the same (see Desired Outcome sheet).
I found a similar question and we implemented it into our Google Sheets.
This script requires, on a separate sheet, the function =result('FormSubmission'!A2:J) to be placed in the first column / row that we wish the data to be displayed (see "Current Outcome" sheet, Cell A2.)
Here is the coding that we are using:
function result(range) {
var output2 = [];
for(var i = 0, iLen = range.length; i < iLen; i++) {
var s = range[i][2].split("\n");
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 == 2) {
output1.push(s[j]);
} else {
output1.push(range[i][k]);
}
}
output2.push(output1);
}
}
return output2;
}
function results(range) {
var output2 = [];
for(var i = 0 /, iLen = range.length; i < iLen; i++) {
var s = range[i][2].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 == 2 /) {
output1.push(s[j]);
} else {
output1.push(range[i][k]);
}
}
output2.push(output1);
}
}
return output2;
}
If someone submits multiple issue numbers separated by commas in the form, the row needs to be split up into multiple rows, as shown in the Desired Outcome sheet.