Customize file picker with download link

Hi support team, Can I customize a retool component file picker for example, to upload csv file via a download link ?

Hey @tahirVanna! Not sure what you mean by via a download link - the file picker is for uploading files from your local hard drive. If you’ve got a download link, you should be able to use that in your query directly.

Thanks Justin. Could you please give me a simple example to use csv download link in my query? Sounds more like my use case. I want to programmatically get data from a csv link and then export via API call.

Sure. It depends what you’re trying to do with the data, but you could fetch the data in a JS Code query and then pass it into your API query.

Thanks for your response. Any example to show please, how the JS query should look like for example ?

Assuming the API call you want to make is called query1 - you could use something like this:

fetch('https://yoursite.com/file.csv')
.then(response => query1.trigger({ additionalScope: { 'csv': response.text } })

You can read more about triggering queries with additional scope here: https://docs.retool.com/docs/scripting-retool

I have a query that uses file picker to loaded downloaded csv on a table. I am trying to replace this file picker with a fetch script to display data on table.
Can I use below and parse query1.data as table data ? I tried already but failed.

fetch('https://account.webspidermount.com/download/post/NDA1MTE3Mzc3Nzg=/')
.then(response => ({ additionalScope: { 'csv': response.text } }))