Update Trello Cards from Your Google Calendar 
Tags: tutorial, wayscript, python
Published: 2020-07-21 13:30:39

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

![](https://cdn.wayscript.com/blog_img/118/calendar_event.PNG)

![](https://cdn.wayscript.com/blog_img/118/trello_cards.PNG)

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

![](https://cdn.wayscript.com/blog_img/118/libraries.PNG)

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:

*   [Working with Time Trigger](https://docs.wayscript.com/library/triggers/time-trigger)
*   [Working with Python](https://docs.wayscript.com/library/modules/python)
*   [Working with Loops](https://docs.wayscript.com/library/logic/loop)
*   [Working with Google Calendar](https://docs.wayscript.com/library/modules/google-calendar)
*   [Working with Trello](https://docs.wayscript.com/library/modules/trello)

Getting Started
---------------

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

![](https://cdn.wayscript.com/blog_img/83/1.png)

  
  
Now, let’s add and enable a simple _Time Trigger_  
  

![](https://cdn.wayscript.com/blog_img/104/time_trigger.PNG)

  
  

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  
  

![](https://cdn.wayscript.com/blog_img/118/google_calendar.PNG)

  
  

Create Variable
---------------

We need to create a variable to store our Trello card description data using the _Create Variable_ module  
  

![](https://cdn.wayscript.com/blog_img/118/create_variable.PNG)

  
  

Calendar Loop
-------------

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

![](https://cdn.wayscript.com/blog_img/118/loop.PNG)

  
  

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  
  

![](https://cdn.wayscript.com/blog_img/118/trello_search.PNG)

  
  

Python Code
-----------

Our python code will be used to build the proper description update for our matching Trello card 
<pre>
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' ] )
</pre>
Update Trello Card
------------------

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

![](https://cdn.wayscript.com/blog_img/118/update_trello.PNG)

  
  

Result
------

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

![](https://cdn.wayscript.com/blog_img/118/result.PNG)

  
  
As always, if you have any questions, comments, feedback, or suggestions, please let us know on WayScript or through our [discord](https://discord.gg/VWbXSbj). If you would like to view this WayScript simply follow the link [Update Trello Card with Google Calendar Event](https://wayscript.com/user/wizgeeky/E7z8S8Rh).