artildo
artildo

Reputation: 77

App Script: get certain spreadsheet by name instead of active spreadsheet

I have an App Scirpt that should work with certain Google Spreadsheet, let's say "database". I then embed this spreadsheet into other web documents, and schedule to run every minute.

From all the tutorials I learnt that I should use the getActiveSheet() function. But this deals with any opened active GSheet in the broswer.

How can I specify for the script to work exactly with the "database" Google Spreadsheet?

Upvotes: 0

Views: 1055

Answers (1)

JPV
JPV

Reputation: 27292

Checkout

  • SpreadsheetApp.openById(id) or
  • SpreadsheetApp.openByUrl(url)

and see if that helps you ?

Reference

If you want to use the name of the spreadsheet you'll have to use the DriveApp class:

  • DriveApp.getFilesByName(name)

Reference

Upvotes: 1

Related Questions