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

197
Vistas
How to retrieve all-suggestion-accepted content of a Document on google Doc through API

As title, I manage to retrieve all-suggestion-accepted content on Google Docs through API. I have referred to its guideline and a couple of posts on this platform but in vain. Below is the snippet I currently have. Please Advise.

function myFunction() 
{
  var documentId ="My file ID";
  var doc = Docs.Documents.get(documentId);
  var  SUGGEST_MODE= "PREVIEW_SUGGESTIONS_ACCEPTED";
  var doc1 = Docs.Documents.get(documentId).setSuggestionsViewMode(SUGGEST_MODE);
  console.log(doc1.body.content)
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Upon seeing the documentation, you should use it like this

Script:

function myFunction() {
  doc_id = '1s26M6g8PtSR65vRcsA90Vnn_gy1y3wj7glj8GxcNy_E';
  SUGGEST_MODE = 'PREVIEW_SUGGESTIONS_ACCEPTED'
  suggestions = Docs.Documents.get(doc_id, {
    'suggestionsViewMode': SUGGEST_MODE
  });

  new_content = '';
  
  suggestions.body.content.forEach(obj => {
    if(obj.paragraph)
      obj.paragraph.elements.forEach(element => {
        new_content += element.textRun.content;
      });
  });

  console.log(new_content);
}

Sample suggestions (with added paragraph):

sample

Output:

output

EDIT:

  • Added an additional paragraph, and instead of just logging them, I have stored them in a single variable and printed at the end.

Reference:

  • documents.get
about 4 years ago · Juan Pablo Isaza Denunciar
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