How to download created csv file using Google Apps Script?

google-apps-script

Solution

Try using ContentService, you can trigger a download and even set the file name via the TextOutput.downloadAsFile method. You can also set the content mime type of the returned data, though only to a predefined enum constant. See their examples.

Problem

I've created a file in Google Apps Script as follows ``` DocsList.createFile( "test.csv", "Row1Col1,Row1Col2 \r\n Row2Col1,RowCol2 \r\n Row3Col1,Row3Col2"); ``` How to download it programmatically (via a popup Download dialog for example) ?

Original source

Related problems