Julien Fritsch
Julien Fritsch

Reputation: 41

Cannot switch my Google Script to a new Cloud Platform project "in an Apps Script-managed folder"

I have 2 google scripts using each one google sheet.

My issue is that one of those scripts (older one) benefits from the Google Cloud Error reporting and email notifications which is very helpful whereas the newer one doesn't.

And it looks like this is due to the fact, that since April 2019, when new scripts are created they are, "a default GCP project is also created behind the scenes." https://tanaikech.github.io/2019/07/05/linking-cloud-platform-project-to-google-apps-script-project/

And indeed, when looking, from the script project side, the Ressource / Cloud Platform project info, I can see that they are not set in the same way:

The older one has clear GCP link visible, whereas the second one (newer) is not showing any project and says instead:

"This script has an Apps Scripts managed Cloud Platform project"

I found this: cloud platform project dialog box

And understood that I needed to create a new standard Google Cloud project, which I did and now when I try to copy the project number I get this error message:

"You cannot switch to a Cloud Platform project in an Apps Script-managed folder."

So I'm clueless now.

Upvotes: 2

Views: 1840

Answers (2)

Julien Fritsch
Julien Fritsch

Reputation: 41

The reason I could not transfer the script to the new project was it was created in the "system-gsuite/apps-script" folder, which is a special folder for the automatic projects created by apps-script. You cannot move scripts from one automatic project to another automatic project.

I moved my new project out to a "normal" folder and everything worked.

To move a Google Cloud Platform project from one folder to another follow the steps:

  • Open GCP console - https://console.cloud.google.com/home/dashboard
  • From here there are multiple ways that you can get to the GCP project
  • Click in the drop down list at the top in the header.
  • A dialog box should pop up with all your GCP projects in it.
  • Another way - Open Resource Manager - IAM -> Manage Resources https://console.cloud.google.com/cloud-resource-manager
  • Open folder "system-gsuite" and then "apps-script"
  • Once you get the GCP project displayed look for either a "Move" or "Migrate" button in the top header

Upvotes: 2

alberto vielma
alberto vielma

Reputation: 2342

I created and associated a new Apps Script project to a Google Cloud Platform project, without any issues. These are the steps I did, please try to replicate them to solve your issue:

1) Create a new project.

2) Go to "Credentials" (There's a key icon).

3) Click Create credentials->OAuth client ID.

4) In "Application type" choose "Web application".

5) Create.

6) Go Home (there's a house icon).

8) Copy "Project number".

9) In your Apps Script project go to Resources->Cloud Platform project...

10) Put the "Project Number" and click on Set Project.

11) Confirm

Docs

Upvotes: 1

Related Questions