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

240
Visualizações
How can I replace text in Google Presentations with text from Google Sheets?

I'm really new to programming in Google Apps Script and I'm trying to replace some words in all my slides with some text from a spreadsheet. I was following an internet tutorial for a similar task, but for replacing data in a Google Docs. I thought it would be the same, but it isn't and I'm kinda lost now. I need to 'translate' this piece of code from Docs to replace text in Slides.

var doc = DocumentApp.openById(copy.getId()); 
var body = doc.getBody();
body.replaceText('name', name);
body.replaceText('adress', adress);
body.replaceText('date', date);

I know I read the slide by this:

var presentation = Slides.Presentations.get(copy.getId());

But I don't know how to do the same task from before, but with my slides. Can someone help?

Edit: I tried what @Kos suggested. Since I have to replace about 20 words, I tried to implement a for loop, but I still don't get my words replaced in the slide.

var dict = {'{{word1}}':word1,'{{word2}}':word2};
for(let i=0; i< dict.length; i++){
    const resource = {
      requests: [{
        replaceAllText: {
          replaceText: dict[dict[i]],
          containsText: { matchCase: true, text: dict[i] }
        }
      }]
    };
    Slides.Presentations.batchUpdate(resource, presentation.getId());
  }

Should I try a different approach for replacing these words?

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