Forum Academy Marketplace Showcase Pricing Features

[New free plugin] Sheet To Pdf - Generate PDF from Google Sheets

Hello bubblers!
I spent a long time looking for an easy and affordable way to generate complex PDF files, after finding a solution, I developed this plugin in order to share this incredible way of generating PDF files with other bubblers. Enjoy it!

This free plugin generates PDF files from your Google spreadsheet template, that means your app can, now, export complex, customizable and powerful PDF documents.
Feel free to create your own template spreadsheet at Googles Sheets, add/edit charts, tables, images, colors, fonts etc. the plugin allows you to send data from your Bubble app database to that template spreadsheet and export the selected sheet or sheets (tabs) as a PDF file for downloading or saving back to the app.

FOLLOW THIS INSTRUCTIONS (DOCUMENTATION) TO SET UP THE PLUGIN IN YOUR APP :point_down:

1. Test the plugin on demo page (click here).

2. Create an account at SheetDB (click here), the plugin uses their API to send data to your spreadsheet. They have a free plan and some paid plans, depending on how you’re going to use the plugin, you may need to sign up for a paid plan, read this entire instruction to understand which will be the best plan for you. Any way, their plans are quite affordable.

3. Create a Google spreadsheet (template);
After creating the spreadsheet, go to Share option to select a kind of access, you must grant access to anyone with the link, as viewer or editor.
Give it the layout and design you want, also leave some fields that will be populated dynamically, like this:

4. Create another sheet (tab) with a table for the data you’ll receive from the API, the first row should contain the column names (as in databases), and the first column name must be “id”, like this:

Note that you can create as many data sheets as you need.
Next, you should connect this data with the fields in the template, as in this exemple:

5. Now that you have access to the API and a template spreadsheet, let’s write down the credentials and IDs you will need to set up the workflows in your Bubble application.
First, open your spreadsheet and get the spreadsheet ID (1), the template sheet ID (2) and the names of the data sheets (3), as in the image below.

Then, go to your dashboard at SheetDB and create a new API, you’ll need to inform the spreadsheet entire URL.
topic5

Save the login and Password codes and click the button save API, now you can get the API ID at the dashboard as well.

Let’s see if you’re not missing anything:

  • spreadsheet ID;
  • template sheet ID;
  • names of the data sheets;
  • login;
  • Password;
  • API ID.

6. Back to your Bubble app, you need to install Sheet to PDF plugin, and inform your login and password.
topic7

Next, you just need to set up the workflows for populating your spreadsheet template and downloading or saving the PDF file to the app database. I will describe below the actions used to build the workflow, but for a better comprehension, take a look at the demo app editor as well, the actions fields are also documented.

There are two ways of sending data to your template spreadsheet:
a - Use action SheetToPdf - Send single row:

Inform the API ID, the name of the sheet and the row that will receive the data. Note that this action allows you to populate only one row of the sheet, that’s why it is not suitable for sending dynamic lists, and populating a lot of rows one by one will become slow.

The field Data must have a JSON structure {“column_name1”: “row text”, “column_name2”: “row text”, “column_name3”: row number}

b - Use action SheetToPdf - Send multiple rows (paid plan only):

Inform the API ID and the name of the sheet, the row will be informed in the Data field, that means you can use this action for dynamic lists and for populating lots of rows.
To build a JSON formatted text for the Data field, you can use Bubble’s operator “Format as text”, as in the image above.
When you open the demo app editor, note that the workflows that contain this action are disabled, because this is a paid feature and I wont pay it just for testing. Anyway, I tested this action when I created the plugin and it works, I left it there for reference.

topic10

The next step is to add an action to download the PDF file or a data call to save the PDF file to your app database, they are similar to each other and you can also find them in the demo app editor, with documentation provided below the fields.

Finally, you finished setting up the plugin in your application. If you have any issue or suggestion, let me know, I’ll be following this thread when I have some free time.
If you need help to set up this plugin, reach out to me and we can talk about freelance work hours.

7. More information

  • You can not send an image, but you can send an URL, and use the IMAGE function in Google Sheets to display the image inside a cell;
  • If many users of your app are going to generate PDF at the same time and using the same template, you should create a log to register when a user send data to the spreadsheet, and set the workflow to wait in case there are simultaneous calls, in order to avoid generating PDFs with data from other user actions.
  • The free plan offers 2 spreadsheet APIs and 500 requests/month. That means you can populate 500 rows, one by one, using the action SheetToPdf - Send single row.
  • The cheaper plan offers 5 spreadsheets APIs and 10,000 requests/month, and you can use the action SheetToPdf - Send multiple rows to populate more than one row at once, it will consume only 1 credit! :smiley:

Enjoy it!!

2 Likes