I have a spreadsheet: https://docs.google.com/spreadsheets/d/1df2cp4DsJvSeBvhsNjLgIa5x_RO1X7s_APRdFzU6jqQ/edit?usp=sharing
| | C
/**
* @param {GoogleAppsScript.Events.SheetsOnChange|GoogleAppsScript.Events.SheetsOnFormSubmit} e
*/
const onFormSubmitORonChange = e => {
const rg = SpreadsheetApp.getActiveRange(),
wd = rg.getWidth(),
sh = rg.getSheet(),
lc = sh.getLastColumn(),
numRows = Math.max(
rg
.offset(0, wd, 1, 1)
.getNextDataCell(SpreadsheetApp.Direction.UP)
.getRow() - 1,
1
),
numCols = lc - wd;
sh.getRange(2, wd + 1, numRows, numCols).autoFillToNeighbor(
SpreadsheetApp.AutoFillSeries.DEFAULT_SERIES
);
};