About Apps Script

Google Apps Script is a scripting platform designed for rapid application development for the fast and easy creation of business applications that integrate with G Suite products. Modern JavaScript is the scripting language being used to write codes. Apps Script includes built-in libraries for G Suite applications such as Drive, Calendar, Gmail, and more.

Read more about Apps Script at https://developers.google.com/apps-script

What is PDF.co?

PDF.co is the secure and scalable data extraction API service with a full set of PDF tools included.


  • Reduces spending by using a flexible AI system for data extraction from receipts, invoices, and other documents;
  • Documents and files such as tables, and PDF forms can be read automatically using the Document Parser that is customizable;
  • It possesses functionality that lets the user fill documents with PDF documents, fields to PDF forms, text, and images;
  • It is a potent, unique tool that allows you to combine, split, and delete PDF pages. It also lets you create PDF from advanced HTML;
  • It is perfect for Enterprise clients as they can utilize review logs and API logs;
  • Offline or on-premise versions can be accessed by Premium users;


  • All documents and files processed by PDF.co are encrypted at rest using AES 256-bit encryption;
  • PDF.co relies on TLS and SSL to transmit data and files (the same security protocols that are used by banks)
  • Runs on award-winning secure certified Amazon AWS infrastructure: https://pdf.co/security

Apps Script and PDF.co integration

To start, please use the button below:

Setup Apps Script+PDF.co


Integrating PDF.co with Google Apps Script

The following code snippet demonstrates Google Apps Script invoking PDF.co API.

Sample Code Snippet

  // Prepare Payload
  var data = {
    "async": false,
    "encrypt": false,
    "inline": true,
    "name": "result",
    "url": pdfUrl

  // Prepare Request Options
  var options = {
    'method' : 'post',
    'contentType': 'application/json',
    'headers': {
      "x-api-key": pdfCoAPIKey
    // Convert the JavaScript object to a JSON string.
    'payload' : JSON.stringify(data)
  // Get Response
  // https://developers.google.com/apps-script/reference/url-fetch
  var pdfCoResponse = UrlFetchApp.fetch('https://api.pdf.co/v1/pdf/merge', options);

  var pdfCoRespContent = pdfCoResponse.getContentText();
  var pdfCoRespJson = JSON.parse(pdfCoRespContent);

We can break PDF.co API integration into three steps.

  • Prepare Payload
  • Prepare Request Options.
  • Invoke Request and consume the response

It’s worth observing the second step where we’re preparing options for request. Here, Request options contain API Key in the header as well payload attribute containing JSON string.

Please review tutorial links for more in-depth articles.



Video Guides:

Related Pages: