Skip to main content
Best answer

I have a working Zap to add emails to Spreadsheets, but I want to process historic messages (not just new)

  • December 17, 2024
  • 5 replies
  • 53 views

Forum|alt.badge.img

Hi,

I have a Zap configrued that takes an email message and then (using python script) it parses the message and inserts it into a spreadsheet.  It works for “New” messages, but for old messages it can’t find them.  (Originally it is based on the “Save new Gmail emails matching certain traits to a Google Spreadsheet” , with an intermediate step to process the message using python).

(I have tried marking the messages as unready, but no luck).

If there a way to tell the zap to proces the histroic email? 

 

 

Best answer by james968

Thanks for the suggestion.  I actually used google Takeout, to export the Historic data, then used an existing python script to extract the data and then merged it with the data from the Zap. 

 

The Zap has continued to work correctly and merges new data in w/out any issue (knock n wood).

“Basically M1 send my a note saying:

> You got paid $1.35 in Dividends in account 123

So I just want this auto added (in the correct column ) to the sheet. 

Here’s the python code I used to parse out the data….. it is very simple, and it is only to help me track my personal stuff.

import reinput_string=input_data.get('DATE', '').split(',')[1:]MyDate=(input_string[0].split(':')[0])[:-3]TEXT=input_data.get('RAW','')RECEIVED=TEXT.split(' from ')[0].split('$')[1]ACCOUNT=TEXT.split(' - ')[1].split('.')[0]output = {'Date': MyDate,'Account':ACCOUNT,	'Amount':RECEIVED}
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

5 replies

Badger
Forum|alt.badge.img+5
  • New
  • 141 replies
  • December 17, 2024

@james968 

You could try using the New Labelled Email trigger. Create an historic email label, set up and publish your zap. Then label the emails you want to process. You could start with one or two as a test cases then bulk label the ones you need to process.

You could duplicate/copy the original zap then change the trigger to the New Labelled Email and see if that works. 


Forum|alt.badge.img
  • Author
  • Beginner
  • 2 replies
  • Answer
  • December 19, 2024

Thanks for the suggestion.  I actually used google Takeout, to export the Historic data, then used an existing python script to extract the data and then merged it with the data from the Zap. 

 

The Zap has continued to work correctly and merges new data in w/out any issue (knock n wood).

“Basically M1 send my a note saying:

> You got paid $1.35 in Dividends in account 123

So I just want this auto added (in the correct column ) to the sheet. 

Here’s the python code I used to parse out the data….. it is very simple, and it is only to help me track my personal stuff.

import reinput_string=input_data.get('DATE', '').split(',')[1:]MyDate=(input_string[0].split(':')[0])[:-3]TEXT=input_data.get('RAW','')RECEIVED=TEXT.split(' from ')[0].split('$')[1]ACCOUNT=TEXT.split(' - ')[1].split('.')[0]output = {'Date': MyDate,'Account':ACCOUNT,	'Amount':RECEIVED}

SamB
Community Manager
Forum|alt.badge.img+11
  • Community Manager
  • 9751 replies
  • January 7, 2025

Just came across this thread and wanted to say thanks for sharing your solution, ​@james968! Really appreciate you taking the time to do that—it’s incredibly helpful for others who might have the same question in future. 🤗 

Thanks for contributing to and improving the Community! 🧡


Forum|alt.badge.img
  • Author
  • Beginner
  • 2 replies
  • January 7, 2025

Sorry, I just realized the python code got mangled, when I pasted it (hopefully this is more understandable):

 

import re

input_string=input_data.get('DATE', '').split(',')[1:]

MyDate=(input_string[0].split(':')[0])[:-3]

TEXT=input_data.get('RAW','')

print(TEXT)

RECEIVED=TEXT.split(' from ')[0].split('$')[1]

ACCOUNT=TEXT.split(' - ')[1].split('.')[0]

print(RECEIVED)

print(ACCOUNT)

print(help(input_data))

output = {'Date': MyDate,'Account':ACCOUNT, 'Amount':RECEIVED}

 


JammerS
Forum|alt.badge.img+6
  • Zapier Staff
  • 3527 replies
  • January 8, 2025

Hi ​@james968,

 

Thank you for sharing the right code for this one. This will significantly help our members with the same issue.