SpreadsheetApp.open(file) Not Found

1,888 views
Skip to first unread message

Russell Savage

unread,
Feb 15, 2014, 10:07:27 PM2/15/14
to adwords...@googlegroups.com
Hi, I am trying to call SpreadsheetApp.open(File file) in my script but I keep getting:
Cannot find method open(File).

The function shows up in the autocomplete list but I don't think it is available for scripts. Is that on purpose?

Thanks,
Russ

Anash Oommen

unread,
Feb 18, 2014, 9:20:47 AM2/18/14
to adwords...@googlegroups.com
Hi Russell,

Could you post a code snippet please? I could investigate this further.

Cheers,
Anash P. Oommen,
AdWords Scripts Team

Russell Savage

unread,
Feb 27, 2014, 3:24:41 AM2/27/14
to adwords...@googlegroups.com
Sure, here is an example that causes the error.  I should be able to call open on SpreadsheetApp with the File as documented here but it throws an error:
https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet-app#open(File)

function main() {
  var fileName = 'SpreadsheetTestFile2014-02-26';
  SpreadsheetApp.create(fileName);
  var file = DriveApp.getFilesByName(fileName).next();
  SpreadsheetApp.open(file);
}

Anash Oommen

unread,
Mar 2, 2014, 11:00:34 PM3/2/14
to adwords...@googlegroups.com
Hi Russell,

I've opened an issue to investigate this further. Thanks for reporting the issue, I'll keep you updated.

Cheers,
Anash P. Oommen,
AdWords Scripts Team

Marcelo Iturbe

unread,
Apr 27, 2014, 12:22:43 PM4/27/14
to adwords...@googlegroups.com
Hi,
Any update on this? is there a bug in the tracker to follow?

Anash Oommen

unread,
Apr 30, 2014, 3:25:24 PM4/30/14
to adwords...@googlegroups.com
Hi Russell, Marcelo,

I sort of tracked this down, the issue is that the File object being referred to is from the Document List API, and it is not compatible with Drive and Spreadsheet APIs. I've asked the team to remove the incompatible method, and you should use the "open with url" version instead.

Cheers,
Anash
Reply all
Reply to author
Forward
0 new messages