As a newbie, I have tried a lot to solve the below problem.
My Current table
TestID TestName Name Url
1592461 Google-page (www.google.com)
1592467 Yahoo - Page (www.yahoo.com)
I am trying to split the data present in the column "TestName" and add the result to the columns "Name" and "URL" as given in the below table
Expected table
TestID TestName Name Url
1592461 Google-page (www.google.com) Google-page www.google.com
1592467 Yahoo - Page (www.yahoo.com) Yahoo - Page www.yahoo.com
I have tried to compile the following script but was unsuccessful.
function getUrl(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s1 = ss.getSheetByName("Sheet1");
var s2 = ss.getSheetByName("Sheet2");
var data = s1.getSheetValues(1, 2, s1.getLastRow() , 1);
var regExp = new RegExp("\(([^]]+)\)");
var row = [];
for(i = 0; i<data; i++) {
var url = regExp.exec(data)[i];
var output = s2.getRange("C2").setValue(url);
logger.log(url);
return url;
}
}
Could someone please help me in solving this.