-1

How can I implement a script that each day at midnight will add a row to a sheets document, with the current date in it, below whatever the bottom cell is that is full?

1

1 Answer 1

0

Use Sheet.appendRow(), like this:

function appendDateRowToSheet() {
  const ss = SpreadsheetApp.getActive();
  const sheet = ss.getSheetByName('Sheet1');
  const timestampFormat = 'yyyy-MM-dd';
  const timezone = ss.getSpreadsheetTimeZone();
  const dateString = Utilities.formatDate(new Date(), timezone, timestampFormat);
  sheet.appendRow([dateString]);
}

Create a time-driven trigger to run the function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.