Edits history of script submission #22381 for ' Download Files (Google Docs, Sheets, Slides) (gdrive)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    type Gdrive = {
      token: string;
    };
    export async function main(
      gdrive_auth: 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 hugo989 6 days ago