Trigger event from new gmail

Are there any APIs or events that can be captured in gmail so that I can initiate a workflow or even run a python script.

I am trying to automate a task that will extract a csv attachment from gmail email. Then there will be ETL csv in BigQuery.

Any thoughts?

+7
gmail google-bigquery
source share
1 answer

I'm not sure about gmail itself,

but try writing a python script using the IMAP library for reading gmail messages and upload it to bigquery using python googleclient. Install it using cron to run every x minutes to check your gmail account.

This should give you the starter code for reading gmail messages:

https://gist.github.com/baali/2633554

If you want only new messages, just replace the search parameter "ALL" with "UNSEEN".

Additional information: https://docs.python.org/2/library/imaplib.html

A python example to upload to BigQuery: https://developers.google.com/bigquery/loading-data-into-bigquery

I am still waiting for IFTTT https://ifttt.com/wtf to provide an API for users to create their own channel or custom actions. those. Google BigQuery Channel

Hope this helps.

0
source share

All Articles