Snippets - XML


XML - Extract Json to Worksheet

var text = '{"first name":"James","lastname":"Smith"}'; 
var mydata = JSON.parse(text);
Excel.run( function (context) {
   var startAddress = document.getElementById('startCell').value;
   var startRange = wsh.getRange(startAddress);
   startRange.load('rowIndex');
   startRange.load('columnIndex');
   context.sync().then( function() {
      var row = startRange.rowIndex;
      var col = startRange.columnIndex;
      for (var prop in mydata) {
          var range = wsh.getCell(row, col);
          range.Values = prop;
          range = wsh.getCell(row + 1, col);
          range.Values = mydata[prop];
          col++;
    }
     context.sync();




© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext