Google script that find text in my gmail and adds it to a spreadsheet? [closed]

喜夏-厌秋 提交于 2019-12-08 13:28:45

问题


I'm looking for a script that will search the body text of emails from a specific sender, find a string of text in the email, such as "You'll receive: US$7.16", then take the number 7.16 and add it to a Google Doc spreadsheet where it would be broken down showing the total for the day, week, month, year. Does anything like this exist, or something like it that could be modified?


回答1:


You could start with the example in How to use Google App Scripts to retrieve Gmail emails in a customised way? (Author even states "Here's a neat javascript code I wrote to get all emails from my Gmail and put the list of sender name in a google spreadsheet.")

From there, you could identify messages from the particular sender you're interested in. (Alternatively, you could use GMail filters to label the email from that sender, then use getUserLabelByName() to grab the threads without requiring a search.)

Once you have the threads & messages, you can grab the mail content as a string using getPlainBody(), from which you can retrieve the monetary values. How does one find the currency value in a string?



来源:https://stackoverflow.com/questions/18134883/google-script-that-find-text-in-my-gmail-and-adds-it-to-a-spreadsheet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!