1

I have only pasted a part of the code which I am trying to run separately.

function myFunction() {
   var files = DriveApp.searchFiles('title contains "Companies_OHLC_0"');
   while (files.hasNext()) {
        var spreadsheet = SpreadsheetApp.open(files.next());
    }
 }

it was working sometime back but I keep getting this exception now:

Exception: Unexpected error while getting the method or property open on object SpreadsheetApp. (line 4, file "Code").

1
  • I have tried OpenByID() and OpenByurl(), still no luck Commented Jul 18, 2020 at 3:39

1 Answer 1

3

I figured it out. I had multiple files with the same name and hence, i was getting that exception.

I had run other scripts which had created new files with the same names.I had not noticied this. I deleted all the duplciate files and I am not getting this exception any more.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.