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.
- Go to https://docs.google.com/spreadsheets/d/1x7KnCREDB9a2sbstnOVa9BGtH-36ahe3ZM5rpBISHxE/edit?usp=sharing
- Clone the sheet
- Click Gmail-to-GSheets > Run
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 (✏️)
This is based on https://github.com/TiagoGouvea/gmail-to-google-sheets-script