I have a form that inputs the form's data into a google spreadsheet. This data is listed in order of submission.
When i clear the content of the spreadsheet, the next data is inputted as if the other data existed, x number or rows down.
- data
- data
clear
- (empty)
- (empty)
- data
Here is the script I'm using to clear the content
function clear() {
var sheet = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/1IEcXuEtkwVmnOEeQE71YQcZTrSkFa1OjlP8JpXGonHk/edit#gid=2015797647').getSheetByName('Form Responses 1');
var lastRow = sheet.getLastRow();
var lastCol = sheet.getLastColumn();
var range = sheet.getRange(2,2,lastRow,lastCol);
range.clearContent();
Is there a different way i should be clearing or selecting the data to clear?
Or is there a way to delete rows that keeps the formatting of the spreadsheet?