ABSYZ ABSYZ

  • Home

    Welcome to ABSYZ

  • About us

    Who We Are

  • Our Expertise

    What We Do

  • Our Approach

    How We Do It

  • Products

    What We Made

  • Industries

    Who We Do It For

  • Clients

    Whom We Did It For.

  • Article & Blogs

    What Experts Think

  • Careers

    Join The Team

  • Get In Touch

    Let’s Get Started

ABSYZ

Bulk Import Email from Gmail to Salesforce

Home / Article & Blogs / Salesforce / Email Service / Bulk Import Email from Gmail to Salesforce

Bulk Import Email from Gmail to Salesforce

By Gokul Rajan inEmail Service, 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 2019-06-06 at 12.54.35 PM.png

    Click create Archive to download MBOX file.

    Screenshot 2019-06-06 at 12.56.27 PM.png
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
  • Screenshot 2019-06-06 at 1.04.11 PM.png

    Run the Python script using Terminal or IDLE.

  • 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.

Point to Note :

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

 

Screenshot 2019-06-06 at 2.27.11 PM.png

eg :

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.

 

bulk import emaildata loadergmailmboxmbox to csvpython
69
Like this post
2 Posts
Gokul Rajan

Search Posts

Archives

Categories

Recent posts

Smarter and efficient way of selecting a candidate with Compare Applicant

Smarter and efficient way of selecting a candidate with Compare Applicant

Tableau CRM: Add action buttons on Table without XMD

Tableau CRM: Add action buttons on Table without XMD

jQuery DataTable in Salesforce Lightning Component

jQuery DataTable in Salesforce Lightning Component

Boost Recruiter’s Efficiency with Smart Candidate Recommendations

Boost Recruiter’s Efficiency with Smart Candidate Recommendations

Audit Trail in Marketing Cloud

Audit Trail in Marketing Cloud

  • Previous PostHighlights of Summer'19 Release Notes: Part I
  • Next PostChange Data Capture Events in Salesforce - Keep your UI Updated with latest data

Related Posts

Smarter and efficient way of selecting a candidate with Compare Applicant
AppExchange ConnectEazy Salesforce

Smarter and efficient way of selecting a candidate with Compare Applicant

Tableau CRM: Add action buttons on Table without XMD
Salesforce Salesforce Einstein Tableau

Tableau CRM: Add action buttons on Table without XMD

jQuery DataTable in Salesforce Lightning Component
Jquery Lightning Salesforce

jQuery DataTable in Salesforce Lightning Component

Boost Recruiter’s Efficiency with Smart Candidate Recommendations
ConnectEazy Salesforce

Boost Recruiter’s Efficiency with Smart Candidate Recommendations

2 Comments

  1. Ethan Birchard
    Reply
    13 January 2020

    Thanks for posting! This is my exact use case. Unfortunately when I run the script I get the following error:

    Traceback (most recent call last):
    File “script.py”, line 117, in
    row.append(lst[0])
    IndexError: list index out of range

    Any suggestions?

    Reply
  2. Alysia
    Reply
    27 April 2020

    Hello! Having an issue using your python script any chance you could help out?

    Reply

Leave a Reply (Cancel reply)

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

*
*

ABSYZ Logo
  • Home
  • About us
  • Article & Blogs
  • Careers
  • Get In Touch
  • Our Expertise
  • Our Approach
  • Products
  • Industries
  • Clients
  • White Papers

ABSYZ Software Consulting Pvt. Ltd.
USA: 49197 Wixom Tech Dr, Wixom, MI 48393, USA
M: +1.415.364.8055

India: 6th Floor, SS Techpark, PSR Prime, DLF Cyber City, Gachibowli, Hyderabad, Telangana – 500032
M: +91 79979 66174

Copyright ©2020 Absyz Inc. All Rights Reserved.

youngsoft
Copy