user3279926
user3279926

Reputation: 71

Google-apps-script snippet throwing error

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.

Upvotes: 0

Views: 63

Answers (1)

Wicket
Wicket

Reputation: 38348

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.

Upvotes: 0

Related Questions