0

I am trying to import an array of object into spreadjs, I am using the fromJSON method but it doesnt get imported, my data is an array of object that looks like this

let jsonObj = 
 [{ 'name' : 'One',
   'id': 1,
   'colour': 'blue'
 },
 { 'name' : 'Two',
   'id': 2,
   'colour': 'yellow'
 },
 { 'name' : 'Three',
   'id': 3,
   'colour': 'red'
 }]

I am currently doing sheet.fromJSON(jsonObj)

teestunna
  • 197
  • 4
  • 17
  • It doesn't look like your data matches [the schema](https://www.grapecity.com/spreadjs/docs/v14/online/jsonschema.html?highlight=json%2C) that SpreadJS uses. – Andy Jun 09 '21 at 01:13

1 Answers1

1

Thank for using GrapeCity SpreadJS - fromJSON method is used to load a complete spreadsheet file based on our SSJSON file format. However, to load an array you can use setBindingPath and setDataSource methods to bind cells to your object properties and then bind the array.

here is an example

GrapeCity Team
  • 837
  • 1
  • 5
  • 8