Error 500 while loading data from CSV

Good morning.

I have an app created with v0 that loads dynamically data from .csv files. It works perfectly when the data is static and in the public folder. However every time I ask him to protect my data and put it in the data/ folder instead of public, and retrieve it via API, the whole loading progress bugs, I keep having the error 500 and it tells me the API fails.

What could be the reason ? How can I manage to correct it (every time i try to solve it with v0 he falls back on dummy data and abandon the API)

v0 in the browser does not have access to a filesystem to load files, so it can’t actually read the CSV directly

The easiest way to get a similar result would be to convert your CSV files to JSON and save it as a JS file, which you can import directly in your code

export const data = []

I’d recommend doing this either by manual edit in the code or locally on your machine and using Git Sync to push it back, since telling the AI to transform a large file will use a lot of tokens

Dear Jacob, thank you very much for your reply!

Ok for converting in JSON format. But where should I put the file then in order to secure it (user should not be able to access it) while letting v0 access it?

Is it the ideal solution for you or would you suggest anything else? The initial Idea behind the csv was to be able to quickly adjust the data easily with excel. Without letting user access it, it needs to be secured.

Again, thank you for your help!

Arnaud

I would like to follow up on my previous message. Do you see any better, simpler or more dynamic solutions?