Download Files (Google Docs, Sheets, Slides) ( gdrive)
One script reply has been approved by the moderators Verified

Created by rossmccrann 241 days ago Viewed 93 times 1 Point

No comments yet

Login to be able to comment
Points: 0
deno
One script reply has been approved by the moderators
Ap­pro­ved
import * as wmill from "https://deno.land/x/windmill@v1.70.1/mod.ts";

export async function main(
  gdrive_auth: wmill.Resource<"gdrive">,
  fileId: string,
  mimeType: string    
) {
  const DOWNLOAD_FILE_URL =`https://www.googleapis.com/drive/v3/files/fileId=${fileId}/export/?mimeType=${mimeType}`;

  const token = gdrive_auth["token"];

  const response = await fetch(DOWNLOAD_FILE_URL, {
    method: "GET",
    headers: {
      Authorization: "Bearer " + token,
      "Content-Type": "application/json",
    },
  });

  const result = await response.json();

  return result;
}

Submitted by rossmccrann 241 days ago

Edited 24 days ago

No comments yet

Login to be able to comment