Implemented Request: Export to CSV in shared server folder from MODLR datasource

Joined
Feb 27, 2020
Messages
23
Likes
19
Points
3
#1
Hi there,

We have a requirement to export to text file/ CSV in the SFTP file location for cube data. We can see there is a utility to move to MySQL in GitHub https://github.com/modlr-the-corpor...ter/Utilities/Utility.Export.Cube to Table.js but we would like to have a similar script or utility to export a file to a server folder location. The data would come from the MODLR cubes (or could come from a MODLR MySQL table too).

Is this something we can put into MODLR?
 

Ben Hill

Administrator
Staff member
Administrator
Joined
Mar 19, 2018
Messages
16
Likes
22
Points
3
#2
Hi Grantham,

Our engineers have added this in version 2.4.816 (unreleased).

JavaScript:
//this creates a csv writer object
var csv = datasource.csv(fileName);
//the file path will be within the filesystem folder (Accessible via FTP and the manage filesystem page.

//write a line to the file.
csv.write(["Here","is","a","mix","or","text","and",1,2,3,true]);

//close the file
csv.close();

//optionally you can change the following settings:
csv.setLineBreak("\r\n");
csv.setDelimeter(",");
csv.setQuoteCharacter("\"");
//defaults are as above.
We'll update the documentation also for this including any edge cases to be aware of.