Product: TIBCO Spotfire®
How to read a CSV file from URL Using TIBCO Spotfire
Previously there have been suggestions to open a CSV file from URL via "Files and data flyout - Browse local file". This, however, downloads the CSV file from the Internet and saves it as a temp file in Windows. When you reload the data, it reloads the temp file from Windows instead of loading it from the Internet, so this could be inconvenient.
One solution to this in Spotfire Analyst is to use a python data function (Introduced in Spotfire 10.7).
You then add a data function, running a python script that will download the file from the Internet. Every time the data function is refreshed, it will download the file again from the Internet.
How to register a data function:
Go to "Tools -> Register data functions... " to register your data function.
Name the data function, select type:"Python script", turn off caching and enter the following script, referencing your URL:
###################
import pandas as pd
outTable = pd.read_csv("https://people.sc.fsu.edu/~jburkardt/data/csv/hw_25000.csv")
###################
When pressing OK, the data function will be executed and embedded in the dxp. When closing down the "Register data functions" window, you will be asked if you want to save it in the library as a separate function. Do so if you are going to reuse it, or just keep it embedded. By executing the data function, the data will be reloaded from the URL.
As of Spotfire 10.8, Web Player does not support this. However, there is an idea in the Ideas portal where it is possible to vote for this to be implemented.
https://ideas.tibco.com/ideas/TS-I-7546
https://community.tibco.com/wiki/python-data-functions-tibco-spotfire
Comments
0 comments
Article is closed for comments.