Export Contact, Leads & Attachments from Salesforce to CSV

Skyvia allows pulling data from Salesforce automatically on schedule. Export all Salesforce data files without a single line of code.

Tutorials July 15, 2023

For many companies, Salesforce remains the most popular CRM provider to manage relationships and interactions with customers. Realizing its importance for the community worldwide, we have made a simple step-by-step tutorial on Salesforce data export.

Export Data to CSV

With Skyvia, you can easily export data from Salesforce to CSV files, which can be further downloaded to your computer or automatically placed to some file storage. The CSV data format is useful because of its relative simplicity and universal cross-platform accessibility. Moreover, pulling data from Salesforce to a CSV file is a convenient way to analyze the data later.

To get data out of Salesforce, you need to create an export package that will perform export of Salesforce data. When creating an export package, Skyvia allows creating several export tasks in one package and, thus, exporting several Salesforce objects – accounts, contacts, leads, attachments, etc. – in a single export operation. When selecting Salesforce objects, you can select either all of their fields or some of them, you can specify various filter conditions, which can be as complex as you may ever need. You are also free to export binary data – export them as an archive with binary files and a CSV with exported non-binary fields.

What is also convenient is that you can schedule data export from Salesforce to execute on a regular basis. The export package will run automatically on the specified time. 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.

5 Steps to Extract Data from Salesforce

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

The package editor opens up. It allows you to select/create source connection, specify target settings, add export 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 export data from Salesforce.

Step 1

Selecting/Creating Source Connection

Under Source, 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 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 optimized for loading or deleting large sets of 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.
Step 2

Specifying Target Settings

Skyvia offers two scenarios of Salesforce data export to target source. First scenario is when you are getting data out of Salesforce to CSV file(s), which can be further downloaded to your computer. This scenario is selected by default in Skyvia.

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

After this, select the Folder where to place the result file(s).

In the export package, you can optionally change default CSV options according to your needs. The CSV options include the following: CSV Separator, Text Qualifier, Row Delimiter, Locale, Code Page.

The most popular and frequently changed parameter is CSV Separator. It is a column separator, which can be a comma (,), a semicolon (;), a slash (/), or a vertical bar (|). By default, comma is used as a column separator. You can also enter a custom value to this box.

Step 3

Adding Tasks to Export Accounts, Contacts or Leads from Salesforce

On the fourth step, we add tasks with objects we want to pull from Salesforce. In our tutorial, we will export Contacts from Salesforce as an example. However, you can export Accounts from Salesforce in the same way if required or any other Salesforce object. To add a task to the package, click Add new on the left of the package editor. The task editor window will open.

In the task editor window, perform the following steps:

  1. In the Object list, select the cloud object you want to export from Salesforce – e.g. Account, Contact, Lead, Attachment, etc. We export Contacts from Salesforce.
  2. Next select object fields, for example FirstName, LastName, Phone, Fax, Email.
  3. If required, select fields of the referenced object, for example Name and Type fields of the Contact.Account referenced object.
  4. Click +Condition to configure filters.
  5. Click +Group to add filter groups.
  6. When everything is ready, click Save to save the configured task.

One export package can contain several tasks. That is why, if you want additionally to export Leads from Salesforce, click the Add new link to add a new task and select the Lead object. Configure this task in the same way as described above.

What is convenient is that the next time you want to export the same kind of data, the tasks will already be created within the package, and it will just take you a click to run the package.

Step 4

Scheduling Salesforce Export

Skyvia also allows you to set a schedule for a package to execute it automatically. This might be useful if you want to configure data export operations to run periodically or if you want to delay 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 export from Salesforce as well as to impose time period restrictions on the package execution for a day.

When choosing Skyvia Salesforce data loader to schedule export, you will considerably save your time, money and efforts in the future.

OPENING SCHEDULE EDITOR WINDOW

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 each workday at a certain time.

  1. Click Week under Run every and select corresponding check boxes next to the workdays.
  2. Specify certain time the package should run on each workday. In our example, we have scheduled the package to run at 10:00.
  3. Select options when you want to start the package execution – Now or At a specific time.
  4. At the end, click Save to save your package schedule.

If you need to make the schedule inactive without deleting it, click Disabled.

Step 5

Saving and Runing an Export Package

When your package for Salesforce data export 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.

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 and target connections, tasks/schedule/parameters of the package, etc. On this tab, you can edit your existing connections and tasks, select other connections or add new tasks to the package, edit schedule, parameters, etc.

Monitor tab shows the current package status and 5 most recent package runs.

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

DOWNLOADING EXPORTED FILE

Salesforce export file is available for manual download for 7 days since the package run. After 7 days, the exported data will be lost. When exporting data to a CSV file, you can download the Salesforce result file manually in the following way:

  1. Switch to Monitor or Log tab.
  2. Click the package run you want to download the results of.
  3. The History Details window opens with the detailed information on a certain package run.
  4. Under Result, click the number of records to download the result CSV file.

The package is considered successful if the most recent package run has loaded all the records successfully. It is marked as failed either when at least one record has not been loaded successfully, or when the package has not been executed completely (for example, when its connection became invalid). In case of some package errors, you will get notification to your email.

As a result, we’ve got a CSV file with all necessary data. The file contains Сontacts exported from Salesforce, which have such account types as Customer-Channel, Customer-Direct, Channel Partner/Reseller according to our filter conditions. We have scheduled the package to run every workday (from Monday to Friday) at 10 a.m., exporting contacts created one day earlier, which means contacts created today will be exported to CSV file the next day at 10 a.m. It is very convenient and eliminates data duplication.