TiagoGouvea / gmail-to-google-sheets-script

Search for emails on your gmail account (using a query) and store results on a google sheets
64 stars 20 forks source link

Gmail to Google Sheet Script

This Google Script can do any search on your Gmail account, and store the results on a sheet file.

The search will be made on your gmail account, from your Google Script. All data will be changed inside your account, with no external access to it.

How to use

  1. Create a new Google Sheet
  2. Access menu Extension > App Script
  3. Copy the content from gmailt-to-sheets.gs to editor, replacing the sample code there
  4. Replace the value on SEARCH_QUERY to your real query (Do your search on gmail first, copy and paste the search terms there)
  5. Click on "Save" button (the flop disk)
  6. Select saveEmails on menu (after "run" and "debug" buttons)
  7. Click on "Run" button
  8. It will ask for authorization at first run, proceed to accepting it (it's your Gmail account authorizing your Google Script account)
  9. After run, the results will be applied to you sheet

Changing fields

If you want to save different message attributes, take a look at gmail-message class and chage your script file the code below comments with a pencil (✏️)