I am using the following script to clear Google form entries at midnight each day.
function clearRange() {
var sheetActive = SpreadsheetApp.openById("1DNeHRC41ryRY9s8wZmlqmoIEhm8MqD601BvqoV26V3o").getSheetByName("Form responses 1");
sheetActive.getRange('A2:E').clearContent();
}
Problem:
- The following day, the form entries are added to the sheet starting at the row below the previous day's entries, not row 2.
Example:
- Yesterday, 10 form entries were entered on the sheet (rows 2 to 11). The script runs at midnight and clears the entries.
- Today, five entries were entered on the form but were entered from row 12 onwards.
I need the sheet to clear and reset, to start entering form entries in row 2 every day.
Is this possible? If so, what changes are needed to the formula? Thank you for your assistance.