How to edit a CSV file before uploading

Hey retool team,
I am trying to create a flow where I need to upload a CSV file to S3 and then use it somewhere, but the issue is the CSV file has BOM character which we need to remove before uploading to CSV.
I wanted to ask if there is a way I can run a script where I edited the file value and removed the BOM character and then continued with upload?

Hey @Manan_Jethwani!

How are you currently uploading your CSVs? If you're using a file input component you should have direct access to the base64 data to manipulate with a JavaScript query. You can also set the component to parse the file which should give you access to it as a JavaScript object that you can encode using, for instance, the Papa Parse library.

From there, you should be able to build out an S3 upload query to upload the data.

How much does this already overlap with your existing process?