DEV Community

Cover image for Export spreadsheet data to a Google presentation
Viktor H. Morales
Viktor H. Morales

Posted on

Export spreadsheet data to a Google presentation

In order to avoid human error and optimize the workflow at the hotel reception where I work, I developed an application that allows exporting data from a spreadsheet (Google Sheets) to a Google presentation (Google Slides).

🇪🇸 Read this article in Spanish on my blog: viktormorales.com

In this article

  • Export data to a Google Slides presentation from a Google spreadsheet sheet
  • Create a PDF from the Google Slides presentation
  • Save the PDF on a folder in Google Drive

🤔 The Problem

We use a Google Sheets document to record information about guests who will use the hotel’s spa day service. Since the voucher is valid for 15 days, we also needed a column that calculates the voucher’s expiration date.

This information then had to be transcribed (copy/paste) into a separate document that has a predefined design.

After that, the document had to be exported as a PDF to be sent to the customer.

Among these steps, the copy/paste moment was especially critical, as we could accidentally copy incorrect information — or even make mistakes calculating the expiration date manually.

💡 The Solution

I created a Google Apps Script that allows the following steps to be done automatically with the click of a button:

  • Populates a Google Slides template with data from the spreadsheet.
  • Exports the Google Slides file as a PDF and saves it to a specific folder in Google Drive.

The Spreadsheet

This sheet contains the relevant information, including issue date, expiration date (calculated automatically with a formula: issue date + 15 days), guest name, and more.

Image description

In the top menu, there’s an option labeled "Create Voucher" — clicking it automatically exports the latest row in the spreadsheet to a PDF.

The Presentation

This is the voucher template created using Google Slides.

Image description

The template has two text fields with the variables {{NAME}} and {{DUE_DATE}}, which are automatically filled in using data from the spreadsheet.

The script replaces those placeholders and saves the final file as a PDF in a Drive folder.

Image description

The Final Voucher

This is the resulting PDF voucher, complete with the guest’s name and the expiration date automatically calculated from the spreadsheet:

Image description

The Code

Without further ado, here is the script:

⚠️ Make sure to update the IDs for the spreadsheet and the presentation.

Top comments (0)