TUTORIAL

How to Import Data into Salesforce

Though nowadays there are plenty of alternative platforms, Salesforce remains the market leader of cloud CRM solutions, which is used by millions of people. In our tutorial, we have focused on how to upload data from CSV files into Salesforce as users often need to import a large number of accounts and contacts or other records from CSV files to Salesforce in a single go. When performing bulk data import into Salesforce with Skyvia, the format of incoming data does not have to match the format of the Salesforce objects. In Skyvia, you can use different types of mapping to convert the structure and content of data in CSV files or in the source system to the structure and content needed in the target system.

Moreover, in addition to importing data from CSV files, Skyvia can also import binary data from zip archives into Salesforce. If you want to know about how to import attachments into Salesforce or to read general information about import operations, follow this link.

To get data into Salesforce, you need to create an import package. When creating an import package, Skyvia allows adding several import tasks to one package and, thus, importing several CSV files into Salesforce – accounts, contacts, leads, opportunities, attachments, etc. – in a single import operation. You can easily configure relation mapping and build relations between objects.

What is also convenient is that you can schedule data import into Salesforce for automatic execution. It can be useful for those users who need to import automatically updated CSV files from the file storage into Salesforce. The import package will run automatically on the specified days and at certain time intervals. If the Salesforce connection becomes invalid or some errors happen within the package, you will receive notifications to your account email or to other additional emails you have specified.

Creating an Import Package

After signing in to Skyvia, you can create an import package by clicking +NEW in the top menu and selecting Import in the Integration column.

The package editor opens up. It allows you to specify source settings, select/create target connection, add import tasks, schedule a package for automatic execution and use additional options if necessary. Among other things, here you can enter the package name or leave it Untitled.

Look at the screenshot below and follow the steps to successfully create a package and import data into Salesforce.

Step 1

Specifying Source Settings

Skyvia offers three scenarios of data import into Salesforce. First scenario is when you are getting data out of a CSV file into Salesforce. This scenario is selected in Skyvia by default, and we take it as a basis for our tutorial.

However, if you want to import data from CSV file(s) placed to a file storage service or FTP, use the second scenario and click CSV from storage service in the source type. After this, click the Connection drop-down list and select a source connection name to import data from. Skyvia supports importing CSVs from Dropbox, Box, Google Drive, FTP, SFTP or any other.

The third scenario is for those users who need to import data from databases/cloud apps into Salesforce. Our platform supports a wide variety of databases/cloud apps — import operations between them and Salesforce. To choose this scenario, click Data Source database or cloud app and select a source connection like Dynamics, QuickBooks, Google BigQuery, etc., to import data from them into Salesforce.

Step 2

Selecting/Creating Target Connection

Under Target, click the Connection drop-down list and either select the existing Salesforce connection or create the new one. To create a new one, click the +New Connection link at the bottom of the connection drop-down list.

After clicking the +New Connection link, the Connection window opens. Search for Salesforce and select it from available sources.

As soon as you do it, you are automatically transferred to the Salesforce Connection window, in which you can specify required parameters.

In the Salesforce Connection window, perform the following steps:

  1. Click Untitled and specify the connection name.
  2. Select the Salesforce environment type you want to use – Production, Sandbox or Custom.
  3. Select authentication method to connect to Salesforce – either OAuth 2.0 or User Name & Password. If you don’t mind storing your Salesforce credentials on the Skyvia server, select User Name & Password.

    If you prefer not to store your credentials, select OAuth 2.0. After that, click the Sign In with Salesforce button below and log in to the Salesforce website in the opened browser window. The OAuth token is generated automatically and will be used for authentication. It is available only if the OAuth 2.0 authentication is selected.

  4. Optionally, specify Metadata Cache parameter. This parameter determines for how long the cached metadata for the connection is considered valid. By default, metadata cache never expires – Skyvia resets it automatically.
  5. Click Advanced Settings and reset available parameters if required.
  6. Select to use Bulk API or SOAP API. By default, Bulk API checkbox is selected. Bulk API is based on REST principles and is good for bulk import of Salesforce data. To find more information about the Salesforce connection parameters, click here. Additional information about Bulk API can be found in Salesforce.
  7. At the end, test Salesforce connection and click the Create connection button.

TASK EXECUTION ORDER

By default, Skyvia analyzes data relations and executes tasks in order, depending on these relations. If tasks are not related, Skyvia may run up to four tasks in parallel.

If you want to run your tasks exactly in the same order they are listed in the package, select the Preserve task order check box in target options.

Step 3

Importing Accounts, Contacts and Leads into Salesforce

On the third step, we add tasks to import Accounts and Contacts as CSV files into Salesforce. You can also import Leads, Opportunities or any other object into Salesforce in the same way if required. To add a task to the package, click Add new on the left of the package editor. The task editor window will open.

Please note that in Skyvia you can add one or more tasks. However, in each task you can import only one CSV file, adjust its source, target and mapping settings. If you want to add another CSV file, create a new task.

ADDING A TASK TO IMPORT ACCOUNTS INTO SALESFORCE

To import a CSV file from your computer, drag your file to the drop here your file area or click the browse link and upload the Accounts CSV. You can also add a zip file with binary data by selecting the corresponding check box.

Check if the CSV Separator is selected correctly and adjust other CSV options if necessary.

Click Next step to start adjusting target settings. From the Target list, select the Account object to import data to. Select the type of operation for the task: Insert, Update, Delete, or Upsert. In our case, we use the INSERT Operation.

When everything is ready on the Target Definition page, click Next step to start configuring mapping. Target columns, which are marked as Required, must be mapped in order for the task to be valid. In our case, it is the Name column, and it has been mapped automatically as we have such a column in our CSV file. Moreover, Phone and Fax columns have also been mapped automatically. To save the first task with Accounts settings, click the Save button.

ADDING A TASK TO IMPORT CONTACTS INTO SALESFORCE

With Skyvia all the relations between the imported files, tables, or objects will be preserved. You need just to specify these relations between the source files, tables, or objects.

As the second task, we add Contacts CSV file and repeat the same steps as with Accounts CSV file. At the end, we configure relation mapping between Accounts and Contacts. The relation between Account and Contact objects is determined by the AccountId field of the Contact object, which stores the ID value of an account, the contact belongs to.

To configure the relation, perform the following steps:

  1. Click the Column list on the left next to AccountId and select Relation;
  2. Click the Referenced Object column and select master CSV file (in our example it is Account2.csv);
  3. Then, in the Column list, select the foreign key column from the Contacts.CSV file — CompanyName;
  4. In the Referenced Column list, we select the corresponding column from the Accounts.CSV file — Name.

ADDING A TASK TO IMPORT LEADS INTO SALESFORCE

In the screenshot below, you can see two tasks already added to the package. If needed, you can add a new one.

You can import Leads as well as import Opportunities into Salesforce the same way as described above – upload CSV files with corresponding data (each CSV in a separate task), adjust source and target settings, choose import operation type – INSERT, UPDATE, DELETE, UPSERT, configure mapping settings and check Salesforce Lead and Opportunity required fields.

Step 4

Saving and Running an Import Package

When your package for Salesforce data import is ready, click the Create button on the right of the page. After that, click Run to immediately run the package or wait until the package schedule starts if you scheduled the package. You can read more about automatic package scheduling below.

As soon as the package is created, you will see three tabs in the middle of the toolbar – Model, Monitor, Log.

Model tab shows source type and target connection, tasks/schedule/parameters of the package, etc. On this tab, you can edit your existing tasks or add new ones to the package, edit schedule, parameters, etc.

Log tab shows older runs or runs for a specified period.

Monitor tab shows the current package status and 5 most recent package runs. When you click a certain package run, the History Details window opens. In this window, if some rows failed, the number of failed rows for a table is displayed as a link. You can click this link to download a CSV file with detailed per-record error log.

Scheduling Salesforce Import

In addition to manually running the import package, you can schedule it for automatic execution. This might be useful if you need to import automatically updated CSV files from the file storage into Salesforce and to run import operations on certain weekdays. You may also schedule an operation to a later time.

Based on your needs, you can schedule the created package for one-time or recurring executions. Recurring package runs can be executed on a daily, weekly and monthly basis — once a day at a specific time or multiple times with intervals. You can select certain weekdays to schedule data import into Salesforce as well as to impose time period restrictions on the package execution for a day.

To set a schedule for a package, click Schedule on the toolbar left side.

The schedule editor window opens. In our tutorial, we schedule the package to execute automatically every Friday at a certain time. For this we need to:

  1. Click Week under Run every and select corresponding check boxes next to Friday.
  2. Specify the certain time the package should run every Friday. In our example, we have scheduled the package to run at 19:00.
  3. At the end, click Save to save your package schedule.

Skyvia offers various subscription plans including the free one with 100,000 records per month. Skyvia can work with all Salesforce editions starting from Salesforce Essentials, and the price does not depend on the number of users and Salesforce orgs. Try Skyvia Import and considerably save your time, money and efforts in the future.