Replacing Data Source in Tableau (Modifying, Updating and Appending Data Sources)

Replacing the data source used in a Tableau workbook allows you to point your workbook to a new data source and re-compute all your results using the new data. This method, however, works only if the new data source shares the same format as the original data source. If the format of the new data source is different than the current data source, you may see changes to custom sets, groups, and calculated fields that depend on the fields in the original data source. However, in many cases, this issue may be resolved by replacing references to valid fields. See the Connecting to Data and Editing Data Sources topic in the Desktop Help for directions on how to replace field references.
Important: Replacing a data source does not merge or edit the data sources. This feature simply redirects fields in the worksheet to map to corresponding fields in the new data source. To successfully replace a data source, any fields, including calculated, groups, sets parameters, etc, in the original data source need to also exist in the new data source. If not, then some manual work may be required to preserve certain fields.
You may create a workbook using an Excel file or SQL Server database, and then switch the data source to Oracle or Teradata, for example. This type of switch is possible with Tableau.

Option 1: Add a Connection and Replace an Existing Data Source

In 7.0 and later, replacing a data source is simplified to adding an additional data connection and then replacing the data source by selecting Data > Replace Data Source.

Step 1 

Open the original workbook that contains the worksheets you want to connect to the new data source.

Step 2 

Select Data > Connect to Data to connect to the new data source.

Step 3 (if needed)

If the new data source does not contain desired calculated fields, groups, sets, parameters, etc. contained in the original data source, copy those fields to the new data source now.

Step 4 

After connecting to the new data source, select Data > Replace Data Source.

Step 5 

In the Replace Data Source dialog box, select the existing data source as Current and the new data source as theReplacement data source, and then click OK.
All the worksheets and dashboards using the previous data connection will now use the new data connection.

Option 2: Add a Bookmark and Replace an Existing Data Source

The option to add a bookmark and replace the existing data source is available in all versions of Tableau Desktop.

Step 1 

Close the existing workbook and Tableau Desktop.

Step 2 

Open a new workbook and select Data > Connect to Data to connect to the new data source. Make sure you give the data connection a name that you can remember.

Step 3 

Drag any field (e.g., Number of Records) into the new workbook. It does not matter which field you use; this step creates a temporary field that you do not re-use.

Step 4 

Instead of saving this workbook, select Window > Bookmark > Create Bookmark (for 6.1 and earlier, select Bookmark >Create Bookmark).
User-added image

Step 5 

Give the bookmark a unique name and save it to the default Bookmark location (e.g., My Tableau Repository).

Step 6 

Open the original workbook that contains the worksheets you want to connect to the new data source.

Step 7 

Select the data source in the Data menu, and select Rename (for 6.1 and earlier, select Data > Data Connection >Rename), and give the data connection exactly the same name as the connection you created in step 2.

Step 8 

Select File > Open, browse to the default bookmark location, and then select the bookmark created in step 5. If you successfully name both your data sources with the same name, Tableau presents the following dialog box:

Step 9 

Select Replace existing data source with new data source to replace the original data connection in the workbook with the new one saved in the bookmark, and then click OK.
All the worksheets using the previous data connection will now use the new data source, including groups, calculated fields, bins, etc.

Working with Tableau Server Data Sources

Changing the​ data source to a Tableau Server data source

For Tableau Desktop 6.1 and earlier, as with the example of Option 2 above, you will need to change the name of the data connection in the Tableau workbook to match the data connection in Tableau Server.
To change the name of the data connection, select the data source in the Data menu, and select Rename (for 6.1 and earlier, select Data > Data Connection > Rename), and give the data connection exactly the same name as the connection you created in step 2.
Then, select Server > Import Data Source, select the data source to import, and click Import. If you successfully name both your data sources exactly the same thing, Tableau presents this choice:
Select Replace existing data source with new data source to replace the original data connection in the workbook with the new one saved in the bookmark, and then click OK.

 

Move Tableau Server data sources from Tableau Server A to Tableau Server B

Suppose you have a workbook that is published to Tableau Server A. This workbook connects to two Tableau Server data sources, data source a1 and data source a2. In some cases, you might need to move the workbook and published data sources from Tableau Server A to Tableau Server B. Although there are a couple of ways to do this, use the following procedure to download the workbook and Tableau Server data sources, and then republish using tabcmd
Step 1: Go to Tableau Server A and download the workbook and dependent published data sources
  1. Open a browser window, and sign in to Tableau Server A.
  2. Download the workbook and dependent Tableau Server data sources, data source a1 and data source a2.
Note: The steps above can be performed using the tabcmd get.

Step 2: Run tabcmd commands to republish to Server B
Run the following tabcmd commands to publish the workbook and Tableau Server data sources to Tableau Server B.
tabcmd login –s http:// –u –p
tabcmd publish .tdsx
tabcmd publish .tdsx
tabcmd publish .twbx
Note: Make sure the names of the data sources published to Tableau Server B are the same as the data source names downloaded from Tableau Server A. 

Troubleshooting

When replacing a data source, the following situations may occur:
  • If the categorical colors on the Color shelf have been customized, when replacing the data source, the colors may revert to the automatic color settings defined by Tableau. The colors will need to be manually adjusted after replacing the data source.
  • If there are exclusions on a view in the workbook, the following message may appear when replacing the data source:
After clicking OK, this message will appear:

If you click OK on the second message, the data source will still be replaced. However, the worksheet with the exclusion will no longer have the excluded value and the exclusion will need to be manually added after replacing the data source.
Another option is to remove the exclusion before replacing the data source. This will prevent the messages above from appearing. Once the exclusion has been removed, replace the data source and then re-add the exclusion to the view.