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

220
Vistas
Issue getting google workspace file (JavaScript)

Im calling request from google workspace file with gapi using this code

gapi.client.drive.files.export({
  fileId: fileId,
  mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
})

from that code i get response back of base64 string to convert as a blob but when i open file in google docs or msword file is corrupt and not working but if i change mimeType into application/pdf it working

same thing also happen in if i request file with application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

am i doing something wrong here or i there is other way to getting file workspace

md5Checksum is not available

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

0

Finally i found solution for this issue according to this official documentation we have two type we can download from google drive.

here my code how i request for file

const res = await drive
            .files
            .export({
                    fileId: fileId,
                     mimeType: yourMimeTarget
                    })
                    .then(res => res)
const blob_file = fetch(`data:${yourMimeTarget};base64,${btoa(res.body)}`)
                 .then(res => res.blob())

so after you fetch google workspace file you will get base64 string than you can convert it into blob

about 4 years ago · Juan Pablo Isaza Denunciar

0

As mentioned in the official documentation for files.get:

Response

By default, this responds with a Files resource in the response body. If you provide the URL parameter alt=media, then the response includes the file contents in the response body. Downloading content with alt=media only works if the file is stored in Drive. To download Google Docs, Sheets, and Slides use files.export instead. For further information on downloading files, refer to Download files.

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