I am trying to connect to Tableau from a Google Apps Script so that I can get the view data and populate a Google Sheet. Not finding any good examples online however.
I am using this code to connect via a Personal Access Token but I do not know how to parse the auth token which is returned in XML (despite me setting the content type as JSON) and then how to make a second call to query the server?
function tableauAPI() {const options = { method: 'post', muteHttpExceptions: true, contentType: 'application/json', accept: 'application/json', payload: JSON.stringify( { credentials: { personalAccessTokenName: 'TestToken', personalAccessTokenSecret: '11122223333444455555', site: { contentUrl: '', }, }, } ),};const response = UrlFetchApp.fetch('https://example.tableau.com/api/3.21/auth/signin', options);console.log(response.getContentText());}