I'm trying to update a graph every week on Friday night in Google Sheets. I tried this code:


This works for the date specified in D6 but of course the data disappears once it's the next day.

How can I make it stick?

Basically I want to save the value that the cell "B1" has on every Saturday. For example - B1=52 on Saturday (02/09/2017) - save value 52 to another cell next Saturday (11/09/2017) B1=68 - save that value. And so on...

I've created an example sheet.

So B1 changes and I need to find a way to hardcopy that value on a specific date.


I made this solution. Not very elegant but it does the trick:

function copyRange() {
             var ss = SpreadsheetApp.getActive(),
             target = ss.getSheetByName('Sheet1');
          var selection=target.getRange("Sheet1!A1:L27");
          var inputRange = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1").getRange("B7");
          var inputValue = inputRange.getValue();
             var column = 12;
             var rows=27;
            for (var row=9; row < rows; row++) { 
              var cell=selection.getCell(row,column);
               if (cell.isBlank()) {
| | | | | |

Your Answer

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

Browse other questions tagged or ask your own question.