Google-apps-script snippet throwing error

user3279926 Source

First, my apologies for a lousy (but accurate) title. I'm trying to take the value of cell AB9 and put it in to cell C9 -- in the same sheet!

Simple, right?

But when I try to run the script, the snippet throws a "Range not found" error, and I can't understand why. (Yeah, it's a PIC error.) Here's what I've got:

    // The following three lines copy the last date in the pay period (cell 
    AB9) to the cell just to the left of "last Thursday's" date

    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var source = ss.getRange("PRIVATE Current Tracking Sheet!AB9");
    source.copyTo (ss.getRange ("PRIVATE Current Tracking Sheet!C9"), 
    {contentsOnly: true});

(The code above is only a small part of a large 225 line script. The code above starts on line 49 and ends on line 54.)

I have checked my syntax and wording, looked at misspellings and anything else I could find, including SO.)

Can someone help a noob? Thanks to everybody.

google-apps-scriptgoogle-spreadsheet

Answers

answered 1 month ago Rubén #1

The spreadsheet shared by the OP shows that the sheet names are Sheet1 and Sheet2

Instead of "PRIVATE Current Tracking Sheet!AB9" use "Sheet1!AB9". Apply the same to the other range reference.

comments powered by Disqus