Get Free Trial

Loading inline CSV string instead of JSON string

David Chen asked on March 7, 2016

this code loads json string, but could we load a csv string instead? like A,B,C,D,…,…,…
var jsondata = [{
“Color”: “green”,
“M”: “September”,
“W”: “Wed”,
“country”: “Canada”,
“state”: “Ontario”,
“city”: “Toronto”,
“Price”: 174,
“Quantity”: 22
}, {
“Color”: “red”,
“M”: “March”,
“W”: “Mon”,
“Time”: “1000”,
“country”: “USA”,
“state”: “California”,
“city”: “Los Angeles”,
“Price”: null,
“Quantity”: 19
var report = {
configuratorActive: false,
data: jsondata,

3 answers

Roman Petrusha Roman Petrusha Flexmonster March 8, 2016


The best way is to use the following syntax:

var report = {
configuratorActive: false,
filename: “path_to_my_csv_file.csv”,
dataSourceType: “csv”
Does it work for you?

David Chen March 8, 2016

so it has to load a physical csv file? 
it can’t load a csv string?

Dmytro Zvazhii Dmytro Zvazhii Flexmonster March 9, 2016

Hi! There’s no way to load csv data as a string in the component. It can be done only with json string. There are two options with csv loading. Firstly, as you’ve already said, you can load data using physical csv file. Secondary, you can use a server script which will be generating csv file for you. Thus you should pass the url in the report, smth like http://localhost/csvGenerator. It will serve as the “path” to your script.
Hope it will help.

This question is now closed