Search code examples
google-drive-apigoogle-slides-api

Strategies to GoogleDrive API limit export download 10 mb


We've been developing a solution which is responsible for generating a PPT with a lot of images embedded and then downloading in the browser via Google Slides and Google Drive API.

So, we discovered in the middle of the project that there's a limitation on the export of files from Google Drive API - currently at 10mb per file. Some PPT's are supposed to have thousand pics on them, so that's not ok for us.

Here's a sample of the method used for exporting and downloading the PPT file.

public byte[] downloadPPT() throws IOException {
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

    driveService.files().export(getPresentation().getPresentationId(),
           "application/vnd.openxmlformats-officedocument.presentationml.presentation").
           executeMediaAndDownloadTo(outputStream);

    if (googleProperties.getRemovePresentationAfterDownload()) {
        driveService.files().delete(getPresentation().getPresentationId()).execute();
    }

    return outputStream.toByteArray();
}

Does anyone has a suggestion of solution that can solve this, that keep us using Google API's?

Thanks in advance!


Solution

  • To export Google Slides without size limit you can use direct link for pptx version:

    GET https://docs.google.com/presentation/d/<FILE_ID>/export/pptx

    Reference: https://www.labnol.org/internet/direct-links-for-google-drive/28356/