Adding Sheets in ui.spreadsheet from blob

For spreedsheet.addSheet(content) the "content" parameter has to generated from a blob returned using webix.toExcel()
Is there a way in which i can achieve that using webix?
i.e spreadsheet.addSheet(contentFromBlob)...

Comments

  • edited September 16

    Hello @Libinvarghese,
    As a solution, you can get Excel data as an array using the toObject() method of Webix Excel DataDriver, apply the needed transformations to it and then, you will be able to add "content" to the sheet:

           webix.DataDriver.excel.toObject(file).then(data=>{
              var records = data.data;
              var content = [];
              for(var i=0; i<records.length; i++){
                for(var r = 0; r<records[i].length; r++){
                  content.push([i+1,r+1,records[i][r]])
                }
              }
              $$('sheet').addSheet({data:content}) 
            }) 
    

    Please take a look at the snippet:
    https://snippet.webix.com/lyys1ne4

  • edited September 16

    @annazankevich it worked, thank you..

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!