✨ Iterating on Input Data

I was recently working on a csv file that I needed to keep changing and I wanted Plotly Studio to pick up on those changes. I know Plotly Studio copies the file into the project for me, but in this case I really wanted it to use the live file so I could change it.

The trick I used was to go into the Data module on the left and ask it to use the specific file path I wanted.

Load data from a file and return a dataframe.

Always use the file "/Users/robertclaus/data/Animals.csv"

Then whenever I changed the CSV file I go back to the home page and re-open the new project to see the latest data!

I found the same trick worked to switch between files with the same columns!

This didn’t work for actually deploying, but I’m mostly exploring locally anyways.

7 Likes

This is really helpful, @Robert_Claus . We’ve gotten a few questions about live updates.
Thanks for sharing, :folded_hands:

This is such a powerful pattern! I structured my prompt a little differently, which allows it to dynamically load the file from a static location on my computer every time the Data module is invoked, and then fall back to the cached file if it can’t find it. That allows you to always have up-to-date data on your local data app, and all you have to do is re-publish it to Plotly Cloud when you want to update the data manually. Here’s what you can add to get similar results:

Load data from ~/Data/my_dynamic.csv and write it to the local project directory if it’s available. Always use the latest data file in the project.

1 Like