Skip to main content

AppSheet

Prerequisites

  • A PolyDoc account and API key — sign up for free, no credit card required. The free plan includes 150 PDF conversions per month.
  • An AppSheet account — sign up for free with your Google account, free for personal use.

Use Case 1: Generate PDFs from App Actions

Trigger a PDF generation from an in-app action button, using Apps Script as a bridge to call the PolyDoc API and store the result in Google Drive.
Action button -> Apps Script (PolyDoc API) -> Google Drive

Set up your app and data source

Open your AppSheet app and verify the data source (Google Sheets or Excel) contains the fields your PDF template needs. Make sure each column name matches the template placeholders.

Screenshot placeholder: /img/guides/appsheet/appsheet-uc1-app-setup.png

Create an Apps Script web endpoint

Open Google Apps Script (script.google.com) and create a new project. Write a doPost(e) function that:

  • Parses the incoming JSON payload from AppSheet
  • Calls https://api.polydoc.tech/pdf/convert via UrlFetchApp.fetch()
  • Includes headers: Authorization: Bearer YOUR_API_KEY, Content-Type: application/json, X-Sandbox: true
  • Saves the PDF blob to Google Drive and returns the file URL

Deploy the script as a Web app with access set to Anyone. Copy the deployment URL.

Screenshot placeholder: /img/guides/appsheet/appsheet-uc1-apps-script.png

Add an Action in AppSheet

In AppSheet, go to Actions and create a new action. Set the type to Call a webhook, paste the Apps Script deployment URL, and configure the HTTP body to include the record fields as JSON.

Screenshot placeholder: /img/guides/appsheet/appsheet-uc1-action.png

Test the action

Open your app, navigate to a record, and tap the action button. Verify the PDF appears in Google Drive. Once confirmed, you can assign the action to a view button or add it to a form's post-submit workflow.

Screenshot placeholder: /img/guides/appsheet/appsheet-uc1-test-action.png

Use Case 2: Automated PDF on Form Submission

Automatically generate and email a PDF every time a user submits a form in your AppSheet app, using a Bot and Apps Script.
Form submit -> Bot -> Apps Script webhook -> PolyDoc API -> Email

Create a Bot with a form submission trigger

In AppSheet, go to Automation → Bots and create a new bot. Set the event to When a form is submitted (or When a record is created) on your target table.

Screenshot placeholder: /img/guides/appsheet/appsheet-uc2-bot-trigger.png

Add a webhook step pointing to Apps Script

Add a Call a webhook step to the bot's task. Point it to the same Apps Script deployment URL from Use Case 1. Include the submitted record's fields in the JSON body.

Screenshot placeholder: /img/guides/appsheet/appsheet-uc2-webhook-step.png

Handle the response

Submit a test form entry and check that the bot fires, the webhook runs, and the PDF arrives via email. Enable the bot in production once verified.

Screenshot placeholder: /img/guides/appsheet/appsheet-uc2-test-bot.png