Search code examples
google-apps-scriptgoogle-slides-api

Save Google Slide as PDF using Google Apps Script


Is there a way to save a Google Slides as PDF file by using Google Apps Script?

I could only find solutions for saving Google Docs and Sheets.


Solution

  • How about this sample script? When Google Docs (Spreadsheet, Document and Slide) is saved and/or downloaded using DriveApp.createFile(), the file format automatically becomes PDF. So we can use the following script.

    Sample script :

    var blob = DriveApp.getFileById("### Slide file ID ###").getBlob();
    DriveApp.createFile(blob);
    

    Note :

    In this case, the filename of created PDF file is the same to the slide.

    Edit :

    If you want to copy the slide file, please use a following script.

    var file = DriveApp.getFileById("### Slide file ID ###");
    file.makeCopy(DriveApp.getFolderById("### Destination folder ID ###"));