Error Importing CSV file into Retool Database

I am having issues importing CSV files into a Retool Database.

I need to regularly import CSV files into my app. Each CSV file is 120+ records. If I try to load the file as a single entity via a filebutton1 component, I get an error (records.map is not a function). If I split the CSV file into smaller chunks (approx 40 records), the data loads successfully.

If I use the "Import CSV" button on the Retool Database Resource page, I can load the full-size file successfully.

Am I doing something wrong, or is this a bug? Thanks for your help.

Hey @Argy!

Would you mind posting screenshots of how you have your input component and upload query configured in Retool?

If you're running into issues when uploading larger CSV and are currently using a Change event handler you might want to switch to using Parse instead.

This might not be the solution for you though so curious to see more about your setup!

Here are the requested screenshots. (I am using the Parse event)

The main point I was trying to make is that the process works - provided the dataset is small enough. But I have to be able to upload the full dataset in one hit or it becomes too cumbersome.

I hope this makes sense.

Hmm... how many columns does the CSV have? And do you happen to have a screenshot of the error? The attached CSV with 375 rows seems to work fine for me in testing, curious if it does for you as well.
table-data (3).csv

Hi Kabirdas. Your test file loads without error from the same button that my data is failing to load (I just changed the table name). The following screenshot should answer your questions:

I could send you the csv file if you like, but I would need to rework it to hide real personal data.

Thanks for that! One more screenshot :sweat_smile: would you mind sharing what parsedValue[0] looks like in this case by expanding it in the left panel? Feel free to DM if it has any sensitive information!

It looks like you might need to use {{ parsedValue[0].Sheet1 }} in your query - can you let me know if that works?

Yes, that fixed it. Thanks so much. Why exactly?

Nice! I don't have a complete answer for you :thinking: It looks as though the file being imported supports multiple sheets which is why you need to key into the correct one. I wouldn't expect this to be the case with a csv though, more something like xlsx. Curious to know how the file was generated.

It was generated from an xlsx file but there was only one sheet in the file. Also, as I mentioned at the beginning, if I take the same csv file and remove all but 40 rows (in a text editor, not excel), then the resulting csv file would load (without the parsedValue[0].Sheet1). So something doesn't seem to be making sense. Good luck figuring out what!