Unlimited users just $99/month

Your whole organisation for one fixed price

Book a demo
View all articles

Launching Multiple Workflows from Google Sheets

Let’s consider a situation where we want to launch multiple workflows in Pneumatic automatically based on some tabulated inputs that we have in a Google sheets spreadsheet.

Use Case for Pneumatic’s Public API

The way we would go about is we would first get information about what kickoff form inputs we’d need to supply for each workflow and use those to structure our spreadsheet and then we would enter inputs for every workflow in our spreadsheet and run a script to launch the workflows in Pneumatic.

Setting up your Environment

We’ve created a google spreadsheet with two simple App Scripts that you can look at and extend. One script gets information about the kickoff form fields from a template, the other launches workflows based on the information you enter in the rows.

The spreadsheet is available at: Launch Workflows Example.

Start by copying it and trying running it as is, by simply supplying your API key. In order to use it, you first enter your api key and the id of the template that you want to launch multiple workflows from.

Alt

Getting the Initial Inputs

You need to supply two pieces of information for the script to work:

  • Your API key and
  • The ID of the template you will be running new workflows from

API Key

You find your API key on the integrations page of your pneumatic interface — just copy paste it into the spreadsheet wherre it says enter your API key.

Alt
Alt

Template ID

To get the template ID go to the template edit page for the template you want and look up at the URL for the template. The numeric value before the last slash is the template ID, just copy paste it into the template ID cell in the spreadsheet.

Alt

Permissions

If you try running either script in the spreadsheet, Google is going to ask you for permission to run them, give the permission by clicking on Allow.

Alt
Alt

Getting Template Data

Once you’ve done that click on the Get kickoff fields button to launch the first script:

Alt

See your Scripts

You can find the scripts in the file by going to Extensions —> Apps Script

Alt
Alt

The script above queries Pneumatic for the template whose id you entered in the spreadsheet and populates the 4th row with the names of the fields as well as the option Ids for fields that have selections.

Once you’ve got the field names and selection IDs, you can enter the values for the kick-off form fields you want to pass to Pneumatic for new workflows in the rows below.

Exporting Values from Workflow Data Fields

Learn how to use Pneumatic’s API to get data from workflow output fields and kickoff form fields in Pneumatic into a google Sheet spreadsheet.

Enter Data for your Workflows

Note, you need to enter the numerical option IDs for fields that have selections. These will have been added in parentheses to the names of the fields that have selections.

Alt

Once you’ve done that, you can click on the Launch Workflows button to launch the second script attached to the spreadsheet:

Alt

This script iterates over the rows starting at row 6 for as long as there is data in the rows. For each row, the script launches a new workflow using the information contained in the cells in that row - this is done by looping over the cells in each row (the second while loop).

You can use this table as is. Depending on the template you choose the field names will vary. Alternatively, you can modify the scripts to extend their capabilities.

Results

If you go into Pneumatic now, you’re going to see your newly created workflows:

Alt

And if your tasks assignees go into their tasks they will see that they have been assigned new tasks from the workflows that have just been created:

Alt