how to export multi row variable set data

MMKK
Tera Expert

How to export Multi row variable set data to excel Please help

1 ACCEPTED SOLUTION

Jace Benson
Mega Sage

You'll have to do a bit more research but you could convert it to a CSV much easier with soemthing like this;

https://github.com/funkyremi/csv-json-convert

This just adds a function with this code;

jsonToCsv: (array, delimiter) => {
        let result = '';
        for (const key in array[0]) {
            result.length === 0 ? result += key : result += `${delimiter}${key}`;
        }
        result += '\r\n';
        array.forEach(line => {
            let lineStr = '';
            for (const value in line) {
                lineStr.length === 0 ? lineStr += line[value] : lineStr += `${delimiter}${line[value]}`;
            }
            result += `${lineStr}\r\n`;
        });
        return result;
},

Then just have to somehow make it an attachment.

View solution in original post

3 REPLIES 3

Jace Benson
Mega Sage

You'll have to do a bit more research but you could convert it to a CSV much easier with soemthing like this;

https://github.com/funkyremi/csv-json-convert

This just adds a function with this code;

jsonToCsv: (array, delimiter) => {
        let result = '';
        for (const key in array[0]) {
            result.length === 0 ? result += key : result += `${delimiter}${key}`;
        }
        result += '\r\n';
        array.forEach(line => {
            let lineStr = '';
            for (const value in line) {
                lineStr.length === 0 ? lineStr += line[value] : lineStr += `${delimiter}${line[value]}`;
            }
            result += `${lineStr}\r\n`;
        });
        return result;
},

Then just have to somehow make it an attachment.

MMKK
Tera Expert

that is a great help. if possible can you also guide me on attachment part please?

Hi @MMKK 

Did you ever figure this out? I'm looking to do the same, but having trouble getting it to work.

 

Thank you,