File Button not working

Hi Retool Support Team,

I want to ask about file button, I use file button to upload CSV file so it can bulk update data to API endpoint, but when I use {{ filebutton.parsedValue }} in table, it return no rows found. I use a books.csv sample data from Retool still not working.

What cause this issue?

1 Like

I have the same issue. Using the same csv on Linux and on Windows. On Linux it parses the file but on Windows it doesn't recognize the file type so it doesn't parse the file.

Hey! Thanks for bringing this to our attention. We have submitted a bug report for this and will update the thread when a fix has been merged!

Howdy! Just wanted to see if there was any update to this issue. We would love to be able to use the file parser component with CSVs. Thanks!

Hey luketgriffith! This issue should be fixed, are you having any issues with the file parsing?

When I upload a CSV using the file button or dropdown zone, it parses the data, but into columns instead of rows. So parsedValue comes out as an array of single value objects, where the key is one string containing the header row, and the value is one string containing all of the columns. It's...unusual.

Hey aac, would you mind sharing the CSV file that you are using? You should be seeing something like this:

Hi Joe,

I can't upload the exact file. The one attached here isn't an exact repro: it does load as columns instead of rows when parsed, but it isn't doing the thing where the column names all get grouped into one key in the object. I'm trying to find a way to recreate that, there's just 500 lines in the problem file that I have to go through to figure out which one is tripping up the system.

test_export.csv (620 Bytes)

Hey aac,

Thanks for the extra context, it could be that there is one line that is tripping up the parsing. I expanded my test sheet to 600 rows and though the data is very simple, it seems to be parsing just fine. Let me know if this doesn't work for you, or you find the row causing the issue!
Test Sheet - Sheet1.csv

Hey Joe – here's a single row CSV that fails to load for me. It all gets loaded into one column, with the column headers as the key and the values as a single string value in the object.

Perhaps of interest: I struggled to make the example any smaller. If I started removing some of the values from the column values with multiple entries (semi-colon separated), it would parse correctly. Made me think that perhaps the length of the row is a factor.

testx.csv (828 Bytes)

Hi @aac I have a hunch what your issue is. When you are using {{filebutton1.parsedvalue}} it's all resulting in 1 column, like this potentially?

The way to get around this is to use {{filebutton1.parsedvalue.[0]}} or the specific index if you have multiple files.

Let me know if that helps. You can see the structure of parsedvalue in the left hand panel or when you hover over the value. It looks like it stores each file as a separate array.

Screenshot 2021-10-01 at 12.42.29 PM

Hi @sidpuri,

That improves but doesn't resolve the issue. It does properly turn the data into a row instead of an object in a column, but the parser is still choking on the list of email addresses.

When you load in the repro file I provided, the parser chokes midway through the Email Addresses column (which is a list of semicolon-separated values). It concats all of the column headers together into a single string, and it gives the value for that row as all of the comma separated values up until where it appears to choke. It puts the remaining values in a "__parsed_extra" field (which appears as a second column after your suggested change).

The parser still seems to be affected by the length. If I remove any of the semi-colon separated email fields, it parses the data correctly.

Hey acc, thanks for the additional information. I was able to reproduce the issue with multiple semi-colon separated values in a column. 2 works, but 3 or more emails in that column break our parsing. I have submitted a bug report for this, and will update this thread when I have any more information for you. Thanks again for passing this information along to us!

1 Like

Thanks @joeBumbaca.

Any suggestions for working around it in the meantime?

Hey aac, it seems that the semi-colons were breaking the parsing behavior. For the same amount of data, comma separated and full colon separated values were working as expected. If you can change the semi-colons out for either of those, parsing should work.

I am facing the same issue and joe i tried your test file and am still getting the same output.
Kindly let me know if there is any resolution for the same.

Hey Inzi, my test file above did not address the underlying issue that aac was having. Do you have multiple semicolon separated values in a column in your sheet? If so, then the resolution at this time is to have full colon or comma separated values in the column. If that's not the case, feel free to share the issue that you are having. Screenshots of the table, sample data etc so that we can get to the bottom of it.

Unfortunately, I don't control how the CSV gets written, so I couldn't remove the semi-colons. Building an intermediate step would have defeated the purpose of using Retool, so that project has just been on-hold.

Hi so my issue is that the data is getting parsed into columns only and not like it should in a table format. I am sharing a link of test file (since I cant attach it) that contains the type of data I need to be parsed and attaching a ss of what happens when I upload it.
P.S I get the same output even when I upload your test file of 600 rows.

Here is the link forgot to add it in the previous message