I've the following situation :
Sheet 1 (input) :
www.url1.com?somestuff
www.url2.com?somestuff
www.url3.com?somestuff
www.url4.com?somestuff
Sheet 2 (expected output):
Col1 Col2
www.url1.com ?somestuff
www.url2.com ?somestuff
www.url3.com ?somestuff
www.url4.com ?somestuff
Here is what I've done until now :
function testwoD() {
var input = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Raw_data");
var output = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet11");
var row_count = input.getLastRow()
var col_count = input.getLastColumn();
raw_data = input.getRange(1, 1,row_count,col_count).getValues()
tempArr = [] // or new Array
for (var i = 0; i < row_count; i++) {
tempArr.push(raw_data[i][6].split("?")[0]);
tempArr.push(raw_data[i][6].split("?")[1]);
}
var toAddArray = [];
for (i = 0; i < tempArr.length; ++i){
toAddArray.push([tempArr[i]]);
}
Logger.log(tempArr)
output.getRange(1, 1,730,1).setValues(toAddArray);
}
And here is the result I have on Sheet2 :
www.url1.com
?somestuff
www.url2.com
?somestuff
www.url3.com
?somestuff
www.url4.com
?somestuff
How can I reach the expected output ? I've read a lot of questions about transposing array but couldn't find the answer that could help me solve my issue.
Thanks !
=split('?')in anarrayformula?