I'm looking to split a cell that have multiple values separated by "\n" via App Script. Itried a few functions that were proposed but nothing seemed to work. Below you can see a sample format and desired outcome.
Thanks.
I'm looking to split a cell that have multiple values separated by "\n" via App Script. Itried a few functions that were proposed but nothing seemed to work. Below you can see a sample format and desired outcome.
Thanks.
I believe your goal is as follows.
\n using Google Apps Script.In this case, how about the following sample script?
function myFunction() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1"); // Please set your sheet name.
const range = sheet.getRange("A2:A" + sheet.getLastRow());
const values = range.getValues().flatMap(([a]) => a ? a.split("\n").map(e => [e.trim()]) : []);
range.offset(0, 1, values.length).setValues(values);
}