
Got it! Here’s a step-by-step guide in plain words for extracting email addresses from Gmail messages using Google Sheets and Google Apps Script.
Step-by-Step Process:
Step 1: Create a Google Sheet
- Open your web browser and go to Google Sheets.
- Create a new spreadsheet by clicking on the Blank option.
Step 2: Open the Google Apps Script Editor
- Inside your Google Sheet, go to the Extensions menu on the top bar.
- From the dropdown menu, select Apps Script. This will open the Apps Script editor.
Step 3: Write the Script in Apps Script
- In the Apps Script editor, you will see an empty editor window. You need to add a custom script to extract email addresses.
- Copy and Paste the following script into the editor:
- The script will search through your Gmail inbox, collect the email addresses from the “From”, “To”, and “CC” fields, and then list them in your Google Sheet.
- After pasting the script, click the Save button (disk icon) to save your script.
Step 4: Run the Script
- Once the script is saved, click on the Run button (the triangle icon).
- The script will start executing, and a pop-up will appear asking for permission to access your Gmail account.
Step 5: Authorize the Script
- When the permission pop-up appears, click Review Permissions.
- Choose the Google account you are using.
- Click Allow to grant permission for the script to access your Gmail account and Google Sheets.
Step 6: Extract Email Addresses
- The script will now run and start extracting the email addresses from the Gmail threads in your inbox.
- After the script finishes running, you will automatically be returned to your Google Sheet.
Step 7: Check the Extracted Email Addresses
- The Google Sheet will now contain the list of extracted email addresses.
- The email addresses will be listed in the first column, starting with the header “Email Addresses”.
Step 8: Clean the Data (Optional)
- If necessary, you can clean the list by removing duplicates or unwanted entries:
- Use Google Sheets’ built-in features like “Remove duplicates” or manually delete any entries you don’t need.
Result:
Now, you will have a Google Sheet with all the extracted email addresses from your Gmail inbox. You can use this list for whatever purpose you need (e.g., organizing contacts or creating a mailing list).
This is a non-technical, simple explanation of how to extract email addresses from Gmail using Google Sheets and Apps Script.