Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

133
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda