It appears that your objective is as follows.
- Your main aim is to divide each cell value using
\n
by utilizing Google Apps Script.
- You wish to arrange the divided values in a vertical alignment.
If that's the case, how about trying out the script provided below?
Tested Code:
function myFunction() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1"); // Please specify 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);
}
- Upon executing this script, the original values are fetched from column "A". Subsequently, the altered values are inserted into column "B".
Additional Resources: