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.
SEARCH_QUERY
to your real query (Do your search on gmail first, copy and paste the search terms there)saveEmails
on menu (after "run" and "debug" buttons)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 (✏️)