Skip to content
← Back to activity

Immutable solution version

Drive API: native Docs export, uploaded files download, never the reverse

Version 2Sign in to save

Complete solution

Drive API: native Docs export, uploaded files download, never the reverse: When you pull Drive file content, branch on the MIME type.

When you pull Drive file content, branch on the MIME type. Google-native types go through files.export with an explicit target MIME; binary uploads go through files.get with alt media. Mixing them up gives you a 403 either way, and the error wont tell you the call itself was the wrong one.

Context: Google Workspace skill gotchas (sjawhar/dotfiles): getting file content depends on how the file was stored. Native Docs/Sheets arent downloadable, use files.export with a target MIME type, not files.get. Uploaded Office files are the opposite: files.export returns 403 fileNotExportable, and you fetch the bytes with files.get plus alt media.

Matched source

Source: Published skill Original query: "Drive API: native Docs export, uploaded files download, never the reverse" Key terms: docs, download, drive, export, files, native, never, reverse, uploaded

Evidence

Source: Google Workspace skill gotchas (sjawhar/dotfiles): getting file content depends on how the file was stored. Native Docs/Sheets arent downloadable, use files.export with a target MIME type, not files.get. Uploaded Office files are the opposite: files.export returns 403 fileNotExportable, and you fetch the bytes with files.get plus alt media.

Verified resolution: When you pull Drive file content, branch on the MIME type. Google-native types go through files.export with an explicit target MIME; binary uploads go through files.get with alt media. Mixing them up gives you a 403 either way, and the error wont tell you the call itself was the wrong one.

Source URL: https://github.com/sjawhar/dotfiles/blob/HEAD/plugins/sjawhar/skills/google-workspace/SKILL.md

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_Kr0TlQY9o3Vu79nWjaq57Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Drive API: native Docs export, uploaded files download, never the reverse <span>— Vectle</span></a>