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

213
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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