S3 Multi File Upload Doesn't Parse CSV

Hi everyone,

I'm using the S3 File Uploader as template. The file upload is somewhat unsuccessful:

  • When I use the single file upload button that comes with the template it successfully uploads my csv files. It also shows the correct preview in the preview window.
  • BUT when I use a multi file upload, as described here Upload multiple files to Google Cloud Store or Amazon S3 | Retool Docs , it uploads a file with some kind of nonsense data. (see screenshot) Even when I only upload one file through that functionality, it returns the same result.

What am I missing?

Many thanks,
Fina

Hi Fina!

Thank you for bringing this to office hours, happy to troubleshoot with you :slight_smile:

To double check, did you follow this first step to create a JS query that loops through each file uploaded?

This is important, since it allows you to loop through each file then trigger the uploadToS3 query for each of those files!

Hi Victoria! Yes I followed the steps outlined in the post! Here's the js script:


And my button triggers that js script when clicked:

What could be the issue??

Perfect, thank you for confirming! So strange that it's returning nonsense. Let me test on my end now.

1 Like

Ah, so it looks like you're uploading a CSV, is that correct? Then do you want to display it as a table in the preview section?

Yes I'm trying to upload csv files! The preview section isn't the problem, that preview section is displaying accurately the contents of the file. The problem is that the file itself is not being uploaded correctly, it somehow corrupts the file during upload. When I download the file, either through the retool download button or directly from the AWS console, and open the file I see the exact same content that the preview section shows. The file somehow gets corrupted?

Got it! It looks like you're setting "CSV" as the type in your upload query when you might actually want to use "Binary" and pass in the base64 data from the uploaded CSV.

^ This is working for me and actually uploading the proper CSV data :slight_smile:

Let me know if that works!

That solved one problem but created a new one :sweat_smile:
It now uploads the file without corrupting it, yay! When I download the file, both through the download button on the retool dashboard or the s3 bucket directly, I have a correct csv file with the data I expect it to have.
The new problem is that the preview window cannot display it correctly anymore. It says the file type is binary/octet-stream instead of csv. I added another clause in the fileType script to handle anything of that type the way csv types are handled but then it only shows an empty table:

Hi! I think the problem was i had to use Binary as ContentType

Thank you!

@victoria not sure about @bderuschi 's post here but I'm still experiencing the issue I described in my latest reply.

Exciting!

You may need to do something like this now to get your CSV Binary into the Table component:

https://community.retool.com/t/issues-with-tables-and-csv-text/16205/8

Let me know if you have any questions about this!

I do have questions about that post (e.g. numbro only does formatting but doesn't decode anything?) but I think I'll just omit the file preview for now. Having a functional multi file upload option is more important and that works now! Many thanks @victoria :pray:

Awesome! Feel free to open up a new post anytime you're ready to dive into that file preview feature :raised_hands:

Glad we were able to get the upload working for you :slight_smile:

1 Like