To pull data from the Tableau API to Google Sheets, first install and open the Apipheny Google Sheets add-on.
Apipheny is a no-code API integrator for Google Sheets that you can use to make unlimited API requests, connect to unlimited APIs, save API requests, schedule API requests, and more. Click here for more info about Apipheny.
1. Install Apipheny by opening the following link on desktop and then clicking the Install button on the page: https://gsuite.google.com/marketplace/app/apipheny/966163326746
2. After you’ve installed Apipheny, open a Google Sheet and then click on the Add-Ons or Extensions option in the top menu. In the extensions/add-ons menu, you should see Apipheny.
Click Apipheny > Import API to open the Apipheny sidebar in your Google Sheets.
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 terminal window. At the command prompt, 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.
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.
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:
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:
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:
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.
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, such as: