Reputation: 41
I am new to Google Apps Script so I am sorry if this is a very basic question. I haven't been able to find something that matches exactly what I need, so I will ask here.
I have a test spreadsheet with one sheet right now called Sheet1. I have data in the cells c3:F3. This data changes as it gets updated frequently. I want to save these values in the same sheet appending it on a row below, starting from row c7:f7 on a set time daily.
It could look something like this 2022-12-15 1 2 4 2022-12-16 5 3 1
How would I go about doing something like this?
All I have so far is just this:
function CopyRow() { let sheet= SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
let dataRange = sheet.getRange(2,3,1,3).getValues(); }
Upvotes: 0
Views: 136
Reputation: 18698
Here's one way to do that:
function appendRow() {
const sourceRange = SpreadsheetApp.getActive().getRange('Sheet1!C3:F3');
appendRows_(sourceRange.getSheet(), sourceRange.getValues(), sourceRange.getColumn());
}
For that to work, you will need to paste the appendRows_()
and getLastRow_()
utility functions in your script project.
You can schedule the function to run once a day using a time-driven trigger.
Upvotes: 0