DEV Community

Derrick Sherrill for WayScript

Posted on

Update Trello Cards from Your Google Calendar

Introduction

WayScript makes it easy to sync Google Calendar events with several platforms including Trello. With a few clicks and a little bit of Python you too can achieve this in just a few minutes

Prerequisites

It is important that your Google Calendar event names are the same as the Trello Card name you wish to sync

Additionally, we will be making use of Time Trigger, Google Calendar, and Trello packages so be sure to import them first via WayScript Libraries tab

The only modules we will be using in this post are a Python module and a Loop module. To learn more about the modules and packages we will be using please take a look at the following resources:

Getting Started

Simply, click the ‘+ New Script’ button found in the top right corner to start creating your new workflow.

Now, let’s add and enable a simple Time Trigger

Add Google Calendar

With the Google Calendar package we are able to ‘Import Upcoming Events’ for this example we will simply focus on today’s events

Create Variable

We need to create a variable to store our Trello card description data using the Create Variable module

Calendar Loop

We add a Loop to iterate through multiple calendar events and update matching Trello cards accordingly

Search Trello Cards

Within our Loop we will want to add a Trello step to search for a card name matching a Google Calendar event

Python Code

Our python code will be used to build the proper description update for our matching Trello card

def buildCard():
  desc = []
  desc.append( variables[ 'Events_Item' ][ 'description' ] )
  desc.append( "Location: " + variables[ 'Events_Item' ][ 'location' ] )
  desc.append( "Attendess: " + ", ".join( variables[ 'Events_Item' ][ 'attendees' ] ) )
  desc.append( "Due: " + variables[ 'Events_Item' ][ 'start' ] )
  return "\n".join( desc )

try:
  if variables[ 'Card_IDs' ][0]:
    variables[ 'cards' ] = buildCard()
except:
  print( "No Trello cards exist with name: " + variables[ 'Events_Item' ][ 'summary' ] )

Update Trello Card

Finally, we will add a second Trello step to actually handle the card update itself.

Result

To verify everything is working as expected you can head to Trello and check the card details to make sure it updated

As always, if you have any questions, comments, feedback, or suggestions, please let us know on WayScript or through our discord. If you would like to view this WayScript simply follow the link Update Trello Card with Google Calendar Event.

Top comments (0)