Skip to main content

Export the results as csv file

  • March 17, 2020
  • 7 replies
  • 49 views

Hello,
Can I somehow export data to csv file using Scripting block?
I need to generate a pretty complex csv file (with more than 100 columns) with a predefined column order, values by default and specific formatting. That is why I do not see feasible using standard “Download CSV” functionality.

7 replies

Forum|alt.badge.img+19
  • Inspiring
  • 3263 replies
  • March 18, 2020

Hey @Yury_Bykov - welcome to the community!

Yes, you can build a CSV in Script Block but then comes the question - what do you do with it? Scripts cannot write to your file system.

One approach - save the CSV file created in Script to a record as an attachment. Then you can view and download the CSV document.


  • Author
  • New Participant
  • 1 reply
  • March 18, 2020

Hey @Yury_Bykov - welcome to the community!

Yes, you can build a CSV in Script Block but then comes the question - what do you do with it? Scripts cannot write to your file system.

One approach - save the CSV file created in Script to a record as an attachment. Then you can view and download the CSV document.


Hey @Bill.French, thanks a lot for the hint, looks promising!


kuovonne
Forum|alt.badge.img+29
  • Brainy
  • 6009 replies
  • March 18, 2020

Hey @Yury_Bykov - welcome to the community!

Yes, you can build a CSV in Script Block but then comes the question - what do you do with it? Scripts cannot write to your file system.

One approach - save the CSV file created in Script to a record as an attachment. Then you can view and download the CSV document.


Or save the CSV to a " multilineText" field.
The attachment field type still requires a file.


Forum|alt.badge.img+19
  • Inspiring
  • 3263 replies
  • March 18, 2020

Or save the CSV to a " multilineText" field.
The attachment field type still requires a file.


But that’s not difficult to overcome.

  • Script Block builds the CSV blob and uploads to public space with a signed URL
  • Script Block updates the record with an attachment
  • Script Block deletes the public space document (or allows the signed URL to expire)

kuovonne
Forum|alt.badge.img+29
  • Brainy
  • 6009 replies
  • March 18, 2020

But that’s not difficult to overcome.

  • Script Block builds the CSV blob and uploads to public space with a signed URL
  • Script Block updates the record with an attachment
  • Script Block deletes the public space document (or allows the signed URL to expire)

Do you have a public space that you recommend?


  • New Participant
  • 1 reply
  • April 29, 2020

Exporting in a custom CSV format would be really great. I can upload the CSV to somewhere external, but then I can’t share my script as others should not trust my host.

I feel like allowing links to URL.createObjectURL(data: Blob), or a new method output.file(data: Blob, filename: string) would be great APIs.


Forum|alt.badge.img
  • Participating Frequently
  • 5 replies
  • October 20, 2022

for me I would to use it to export after I remove duplicates across tables and have a new list of records.
so when I get that list I would like to export it as a CSV to re-inject it in a brand new table.

ps I don’t really get the answer, there is nothing in the scripting documentation that talks about export or CSV