Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8985891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:25:30+00:00 2026-06-15T21:25:30+00:00

Cannot find method open() . If it can’t find it, why does it let

  • 0

Cannot find method open().

  1. If it can’t find it, why does it let me choose it when I type the dot?
  2. So how am I supposed to open a file? openByID()? Really? Where do I get this magical ID? From getURL? Seriously? This is the only thing that comes up:

    SpreadsheetApp.openById(id).getUrl()
    

    but I fail to understand how I’m supposed to get the URL if I don’t have an ID to hang it on… leading to a catch 22. Further, I presume in the event I do get the URL I still need to parse it to get the ID… and what magical method have they supplied for that particular incantation?

Clearly, my understanding is lacking. Any help?

function copyTemplate() {
  var targetSpreadsheetName="The file";

  var targetSpreadsheetID=SpreadsheetApp.open(targetSpreadsheetName).getId();
  targetSpreadsheetID.insertSheet("CellData", 1, {template:temp});


  // The code below will duplicate the sheet named "CellData" and insert it after 
  // the 1st sheet and call it "CellData"
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var temp = ss.getSheetByName("CellData");
  ss.insertSheet("CellData", 1, {template:temp});
}

The question is multi-part.

The error message returned was “Cannot find method open().”

The first question is “Why can’t it find method open()?”.

The second question is “If in fact, it can’t find it, why does it let me choose it when I type the dot?”

The third question is “Considering the fact that the open() method fails to work, how am I supposed to open a file?” The presumed answer I expect to receive from the community is “with openByID()”.

That leads to the fourth question which is “Where do I get the ID?”. The apparent answer seems to be “getURL()”.

And that leads to the fifth question which is “How do I use getURL()?” getURL seems to require an ID. If getURL requires an ID to get the URL, and openByID requires a URL to get the ID, you have an infinite loop. Surely I’m misunderstanding something.

The sixth question is “In the event getURL() ends up being part of the solution, how does one distinguish the ID from the rest of the string returned?”

I hope that clarifies my question.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:25:32+00:00Added an answer on June 15, 2026 at 9:25 pm

    Well I’ll finally try to answer your question, hoping you’ll find it clear enough… 😉

    First thing first :

    var ss = SpreadsheetApp.open()
    

    does indeed appear in the autocomplete after the dot, what you didn’t pay attention to is that the argument is a file, ie an object returned by an appropriate statement.
    Now let’s see how to get it and , with this example how the other parameters of this file can be obtained :

        function myFunction() {
        var files = DocsList.find('thisisthesheetIwant');// this is an array of file objects that include the term 'thisisthesheetIwant'
        var file = files[0];// I take the first one
        var filename = file.getName();//and get its name
        var fileId = file.getId();// its ID
        var fileurl = file.getUrl();//and its url
    // then I show the results in the logger
        Logger.log('number of file found = '+files.length+'\n\n'+filename+'\n\n'+fileId+'\n\n'+fileurl+'\n\n')
        var ss = SpreadsheetApp.open(file);// using that file object I can open a spreadsheet
        var content = ss.getSheets()[0].getDataRange().getValues().toString();// and get the whole content of the first sheet
        Logger.log('content = '+content);// there it is
        }
    

    The spreadsheet with its code is available here so you can test it by yourself, I named it thisisthesheetIwant hoping you don’t have any file with a similar name or content since it wouldn’t work as I expected if more than 1 file was returned.

    Look at the logger and I hope it will answer your question(s).
    it should appear like this below :
    enter image description here

    And the sheet itself is like this :

    enter image description here

    EDIT : note that the ID and the URL have a common part, the url is what you can see in your Browser’s adress bar, the ID is just a part of it.
    Now you can open the same spreadsheet with

    SpreadsheetApp.openById(fileId)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have bug that i cannot find, i have Class Point with method who
I cannot find a simple example about my question above: how can i detect
Cannot find any example on Google.
I cannot find any info on agner.org on the latency or throughput of the
I cannot find the solution for this problem, here is the simplified example: On
I cannot find a way to get a Book's Ratings through the Books API
I cannot find where the sqlcmd is? i just want the prompt. please help!
I cannot find a dictionary entry by key. I have an interface like the
I cannot find EntityConfiguration. The same question for RC was here but I thought
I cannot find much documentation of the Boost version of discrete_distribution. After much Google

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.