Creating a CSV download page with SSJS

Devs United > SFMC Pros  > Creating a CSV download page with SSJS

Creating a CSV download page with SSJS

Yesterday we were looking for a way to generate a CSV file based on a request for data to a Data Extension.

Turns out that you can accomplish this with a few lines of code in Server Side JavaScript using Landing Pages.

Just create a new Landing Page that has Text as the content type and add the following code:

 

 

As you can see in the code above, all you need to do is make sure you are writing the content of the CSV file into the page first, so from there you could replace my code example with a request to a Data Extension based on parameters that the page receives and add that as a link on an email or another web page.

Hope you find this useful!

devsutd