Monday, June 10, 2024

Python for Google Gmail annoyances

Very recently, I tried to manage my emails using Python and Google Cloud APIs. My IDE is Visual Studio Code.

I readily admit that I am not an expert software developer, but I have programmed on a large number of different projects in at least half a dozen different languages over many years. None of these projects were very large and complex. 

However, for some odd reason Google made it extremely and unnecessarily complicated to do this. The Google provided examples, tutorials and error messages were not very helpful. I had to give up after several days and many hours of intense trial and error.

Compare that to the JavaScript GmailApp library provided for Google Apps Script. I have previously and successfully used this library to manage my emails in Gmail through Google Sheets. Unfortunately, there is nothing comparable to the GmailApp available for Python from Google! Very regrettable since Python has become such a popular programming language in recent years not least thanks to machine learning & AI!

What I do now is to dump certain email messages as a simple text file (MBox file) using Google Takeout. Next I use Python to parse the email messages etc.

P.S. About Google Takeout I could write another annoyances blog post (e.g. it dumps also all trashed emails associated with a custom label). Generally speaking, Google Takeout is very primitive! Why was a bulk email dumping feature not integrated into Gmail in the first place!!!! Grrr!

No comments: