I wrote the question above, worked on the problem a little longer, and came to the following solution.
Warning: it is anything but ideal, but it works.
Put simply I wrote a small Python script using only one external library - pyautogui
- the others are all native (time json requests
) which retrieves my data online, updates a local file and executes the actions required to manually update the workbook in Tableau. You just need to create your workbook and the visualization you want and then run the script.
Here's the script:
import pyautogui, time
import json
import requests
def auto_tab (url_name, file_name, workbook_name):
url = url_name
r = requests.get(url)
data = r.json()
with open(file_name, 'w') as f:
json.dump(data, f)
pyautogui.press('win')
pyautogui.typewrite('Tableau')
pyautogui.press('enter')
time.sleep(5)
pyautogui.hotkey('alt', 'o')
time.sleep(2)
pyautogui.typewrite(workbook_name)
pyautogui.press('enter')
time.sleep(5)
pyautogui.press('f5')
time.sleep(2)
pyautogui.press('enter')
time.sleep(5)
pyautogui.press(['alt', 'space', 'c'])
time.sleep(2)
pyautogui.press('enter')
time.sleep(10)
return print('done!')
times_to_repeat = 3
while times_to_repeat >= 0:
auto_tab('your_url', 'your_file', 'your_workbook')
times_to_repeat -= 1
So, like I said: it's not ideal, but it works.
Downsides:
- You need to have your machine running to run the script (perhaps you can run it from a server or a VM)
Upsides:
- You can live graph even if you have embedded the graph in html
- It's fast
- It's free