Issues when passing filename with form-data in workflow resource

I have an Retool DB where I get some product information, convert it to csv format and then send it to our partner's system with POST-request as a csv-file named "file.csv".

How should I convert this data to that CSV-format and send it as file in POST Request?

I have tried multiple different ways of processing the data with JS and nothing seems to work as intended.

I have a file generation workflow that encodes to CSV using the following:

let unencoded = Papa.unparse(yourQueryNode.data)
let encoded = btoa(unencoded)
return [{
  data: encoded,
  name: 'YourFileName.csv',
  contentType: 'csv'
}];

I think this should work OOTB since the Papa libraries are included in the workflows by default.

Is there more info about the encoding type required for your POST request? I am not sure you need to create/return a new FormData object.

Hey,

Great!! That works! I managed to make some python requests botch for the time being but that your solution is exactly what I wanted. So to do it with less coding and to use that Retool resource instead of making it with python API call.

Thank you for your help!

2 Likes