Upload and parse CSV tutorial needs to be updated

Followed the tutorial here: https://docs.retool.com/docs/insert-csvs-into-a-database and used the csv linked in the tutorial only to find that the filepicker parsing created a 2d array.

If this is the default behaviour, then the tutorial should say {{filepicker1.parsedValue[0]}}

3 Likes

Hey @dsottimano and welcome to the forum! I just went through the tutorial with a normal CSV, and it was a 1D array (so .parsedValue worked correctly without indexing the array). Is there anything unique about your CSV that might cause the FilePicker to nest the array a level deeper?

Hey Justin, I actually used the csv linked in the doc: https://cdn.tryretool.com/docs/books.csv.

I also tried creating a new csv with 1 column and had the same issue. Weird.

Super weird, it’s working fine for me with books.csv. What browser / machine are you on?

Just tested this using the provided books.csv file as well and was unable to even parse the values.

Browser: Version 92.0.4515.131 (Official Build) (x86_64)
Machine: iMac Pro (MacOS Big Sur v11.4 (20F71)

Update:

You have to turn on the toggle for Parse files in the Inspect editor (this should be added to the tutorial module for uploading CSV data).

Problem: After turning that on, the data that populates in the table is a 2D array.

Additionally: Also, I tested this on Safari and despite turning on the Parse values toggle, it still does not populate the table with data.

See next post for image since new users cannot embed more than one image per post.

1 Like

Screenshot depicting books.csv being parsed as a 2D Array. ↓

Confirming what Dave said and that the documentation should read {{upload1.parsedValue[0]}} if people want this to work correctly. Had to do that to flatten the array.

Hey all!

Thanks for flagging this! I just updated the docs to reflect this change, hope this helps, let me know if you have any questions! :)

I think this needs an update again as the tutorial doesn't work as intended. There is nothing in the "parsedValue" it just returns array [] when following the exact steps (same as above) Insert CSVs into a database

Hey @griffxbio!

Thanks for surfacing this, it looks like there's a bug where the parsedValue property of the file button component isn't displaying properly in the model browser. It seems to still be evaluating when I test it, is that the same for you as well?

Mine seems to be populated (windows + firefox). I just had to toggle the "Parse Files" on (which isn't in the documentation).