Bulk Import Email from Gmail to Salesforce

Bulk Import Email from Gmail to Salesforce

Use Case : Customer needs to import all emails along with attachment from their Gmail account into their Salesforce org.

Problem: Currently, there is no way to mass-import emails within the Salesforce User Interface

Resolution: We are going to export email into MBOX format.Then using python script we will generate CSV and using data loader we will insert email into Email Message object in salesforce.

Prerequisite:

1.Python 3.X should be installed in Local system.

2.Data loader.

Step 1:

  • Go to https://takeout.google.com/
  • Sign In to Gmail Account to extract Email.
  • Check Mail and select the labels to extract all the related Emails.

Screenshot

Click create Archive to download MBOX file.

Screenshot

Step 2:

  • Place the MBOX file and Python script in a same folder.
  • /*** Rename the MBOX file to Sample.mbox***/.
  • Get python script from this Github link Python Script
  • we will get 2 CSV files ( emailMessage.csv, attachment.csv ) as output along with all the attachment files.
  • Message-Id column in  emailMessage.csv will act as unique id for each message.
  • If there is any attachment, we can find in  attachment.csv file. Each attachment will have message Id to signify this attachment belong to which email.

Screenshot

Point to Note :

In attachment.csv file, Body column prepend the current file path with file name(already present).

Screenshot

Step 3:

  • Create Custom Fields in Email Message object to store Message-Id.
  • Insert emailMessage.csv using Data loader into salesforce.
  •  In success.csv file we can get Message-Id and corresponding Salesforce record Id.
  • In attachment.csv file get the parent id based on Message-Id using VLOOKUP.
  • Insert attachment.csv using data loader.
  • we can find Attachment under Email Message related List.

Leave a Comment

Your email address will not be published. Required fields are marked *

Recent Posts

future-of-ai-powered-business-solutions
Dreamforce 2024: Unveiling the Future of AI-Powered Business Solutions
gitex 2024 worlds largest tech show
GITEX 2024 |  World's Largest Tech Show - ABSYZ
inclusive practices in women leadership equitable future
Inclusive Practices in Women’s Leadership: Equitable Future
salesforce dreamfest 2024 the highlights of dreamforce 2024
Dreamfest 2024: The highlights of Dreamforce 2024
DocuSign CLM the ultimate tool for managing contracts
DocuSign CLM: The Ultimate Tool for Managing Contracts
Document

How can i help you? close button

powered     by   ABSYZ
Scroll to Top