Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

126
Vistas
How to set the Google Cloud Platform Project of a container-bound script using Apps Script

So my app creates spreadsheets programmatically as our projects expand (a new spreadsheet for each project). Each spreadsheet has a container-bound script that has some javascript in it to give the spreadsheet some extra functionality. Now I need all the scripts attached to these spreadsheets to use the same GCP project. I know how to set the GCP project manually (from this article), but I need to be able to set the GCP project programmatically when the spreadsheets are created.

I figure this can be done using UrlFetchApp, but I can't figure out the url that the "Set Project" button uses to make this happen. I tried inspecting the html on that settings page, but it's like 16000 lines of code, and while I found the button, I can't figure out the url it posts to.

Can someone help me out here? I need either the formatting of the url post, or another method to set the GCP project of a script with Apps Script.

Here's my code that I'm planning to use:

function changeGCPproject() {
  const scriptId = '1Q8Frqjb6vh5....';
  const gcpProjectNumber = '596....';

  const url = `https://script.google.com/home/projects/${scriptId}/whateverformat?projectNumber=${gcpProjectNumber}`; //this is the url formatting that I need
  
  const token = ScriptApp.getOAuthToken();
  const params = {
    method: 'post',
    headers: {
      Authorization: 'Bearer ' + token,
    },
    muteHttpExceptions: true
  };
  UrlFetchApp.fetch(url, params);
}

Thanks!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda