I have a spreadsheet with multiple email id's in it. I would like to split those email id's into multiple columns. I am able to split the values in first cell, But I'm not able to do it for the rest of the rows. There are more than 100 rows with comma separated email id's.
This is my code. Correct me if there is any mistake.
function myFunction() {
var sheets = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var data = sheets.getDataRange().getValues();
for(var i=0;i<data.length;i++){
var cell = data[i][0].split(",");
var row = sheets.getActiveCell().getRowIndex();
var col = sheets.getActiveCell().getColumnIndex();
sheets.getRange(row,col+1,1,cell.length).setValues([cell]);
}
}
Thanks