Tableau is a popular data visualization software. In this tutorial, you will learn how to connect the Tableau REST API to Google Sheets in 5 steps:
Apipheny is an API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to unlimited API data sources, make unlimited API requests, and more. There is a 30 day free trial included.
1.) Install Apipheny by opening the following link on desktop and then clicking the Install button in the Google Marketplace: https://apipheny.io/install
2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.
In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.
Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new
After logging into your Tableau account, follow these next instructions:
Copy paste the following request body to an XML file named signin.xml:
<tsRequest> <credentials name="USERNAME" password="PASSWORD"> <site contentUrl="SITE_NAME" /> </credentials> </tsRequest>
Don’t forget to replace:
Then open a a command prompt window (for Windows OS) or a terminal (for Mac OS). At the command prompt/terminal, navigate to the directory where you saved signin.xml. Replace “MY_SERVER” with the name of your server in the following command, and then run it as follows:
cd /…/<dir-containing-sign-in-xml> curl "https://MY-SERVER/api/3.4/auth/signin" -X POST -d "@signin.xml"
Don’t forget to replace MY-SERVER with the name of your server.
Note: For Mac OS you may need to use single quotes ( ' ) instead of double quotes ( " ).
In the response, you will receive these credentials: token, site id, and user id. Save these values to a safe location, because you’ll need them in the next steps.
Note: If the token/key that you generate has an expiration time, you will need to complete this same process again to get a new token when the old one expires.
In this section, I’ll show you how to browse the Tableau API documentation to find an API endpoint URL that retrieves the specific information you need from your Tableau account.
If you already know your API URL, or you want to use the same example URL as us, just skip to Step 4.
First, open the Tableau API documentation page: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm#
The main section contains a description of the Tableau REST API and links to resources for different API versions, including the current one:
The menu on the left contains a list of available Tableau API categories, each with its own endpoints:
For example, when clicking the Site Methods category in this menu, in the main section you should see a short description of the category and of its endpoints:
Each endpoint’s documentation contains a short description of that endpoint’s purpose, its URI, request body, attribute values, permissions and headers, as well as request examples:
All API calls to Tableau are made to this base URL:
https://SERVER_NAME/api/3.9/
All endpoints should be appended to this base URL. Don’t forget to replace SERVER_NAME with your server.
Now, to get your Tableau data in your Google Sheet, go back to your spreadsheet and make sure that you’ve installed the Apipheny add-on and you have it opened on the “Import” tab.
In the Import Tab, enter the following details into the Apipheny add-on:
Method: At the top of the Apipheny sidebar, select the HTTP method (GET or POST) required by your Snapchat API endpoint. For this example, we are using the “GET” method.
API URL: In Step 3, we explained how you can find the Tableau API endpoint that you need. Now copy your complete Tableau API URL into the Apipheny add-on, in the field that says API URL Path (JSON / CSV), followed by any GET parameters required for your query (if applicable). For this example, we are using the Query Site endpoint, which returns information about the specified site. The corresponding URL for this endpoint is:
https://SERVER_NAME/api/3.9/sites/SITE_ID
If you’re following the same example as us, you can copy and paste this URL into the “API URL” field in the add-on. Don’t forget to replace SERVER_NAME with your server and SITE_ID with your site id, which you obtained in previous steps.
Headers: In the Headers section of the Apipheny add-on panel, add two rows, with the following key and value:
Header 1 Key: X-Tableau-Auth Value: your_token Header 2 Key: Accept Value: Application/json
your_token is the value of the token you obtained previously, in Step 2. Here’s what your API request should look like when entered into Apipheny, if you’re following the same example as us:
Lastly, click the Run button at the bottom of the Apipheny add-on and then wait for the Tableau API data to be retrieved and added to your Google spreadsheet:
After making a successful request to the Tableau API in your Google Sheet, try querying a different Tableau API endpoint, or try using one of the more advanced features in the Apipheny add-on.
Crypto API tutorials and more:
Sponsored by Zink Virtual Tip Jar & Rewording.io Paraphrasing Tool
Accept donations on Twitch | Accept donations on Discord | Accept donations on YouTube | Accept donations on Telegram | Accept donations on Twitter | Accept donations on TikTok | Accept donations on Instagram | Accept donations on LinkedIn | Accept donations on Facebook | Accept donations on your Website