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

212
Vistas
google docs api documents.get multiple fields ? (nodejs)

How can I select multiple fields when using the documents.get ?

Right now I am getting the documenmt like this:

  const doc = await docs.documents.get({
    documentId: copiedFile.data.id,
    fields: 'body/content'
  });

which returns this:

"data": {
  "body": {
    "content": [...]
  }
}

However, I need to also get the inlineObject and the only way so far I have been able to do so, is by removing the fields proeprty completely

  const doc = await docs.documents.get({
    documentId: copiedFile.data.id,
  });

Then I get this:

"data": {
  "title": "Some document title",
  "body": {
    "content": [...]
  },
  "headers": {
  },
  "footers": {
  },
  "documentStyle": {
  },
  "namedStyles": {
  },
  "lists": {
  },
  "revisionId": "some-long-id",
  "suggestionsViewMode": "SUGGESTIONS_INLINE",
  "inlineObjects": {
  },
  "documentId": "some-long-id"
}

But I am really only interested in data.body.content and data.inlineObjects When selecting everything the response is many thousands of lines of json larger, which I don't want.

I have tried fields: ['body/content', 'inlineObjects'] but that only returns body.content and not the inlineObjects - also the documentation doesn't mention this syntax anywhere, it was just to experiment.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I think it doesn't return any inlineObjects when you don't have any inlineObjects in the document. To confirm if the actual format is working and the statement above is true, try using other fields where a value is confirmed to be returned such as revisionId or title.

Test:

const doc = await docs.documents.get({
  documentId: copiedFile.data.id,
  fields: 'body/content,inlineObjects'
});

Output:

output

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