setDataSource

Binds the sheet to a DataSource instance. For more information on the data-binding Spreadsheet functionality, refer to the article on binding the Spreadsheet to a data source.

Parameters

dataSource kendo.data.DataSource

The DataSource instance.

Example
<div id="spreadsheet"></div>
<script>

  var dataSource = new kendo.data.DataSource({
    transport: {
      read:  {
        url: "//demos.telerik.com/kendo-ui/service/Products",
        dataType: "jsonp"
      }
    }
  });

  $("#spreadsheet").kendoSpreadsheet();

  var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
  var sheet = spreadsheet.activeSheet();
  sheet.setDataSource(dataSource);

</script>
columns Array optional

Columns configuration.

Example
<div id="spreadsheet"></div>
<script>

  var dataSource = new kendo.data.DataSource({
    transport: {
      read:  {
        url: "//demos.telerik.com/kendo-ui/service/Products",
        dataType: "jsonp"
      }
    }
  });

  $("#spreadsheet").kendoSpreadsheet();

  var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
  var sheet = spreadsheet.activeSheet();
  sheet.setDataSource(dataSource, [ "ProductName", "UnitPrice" ]);

</script>
Example - reorder columns and change column titles
<div id="spreadsheet"></div>
<script>
  var dataSource = new kendo.data.DataSource({
    transport: {
      read:  {
        url: "//demos.telerik.com/kendo-ui/service/Products",
        dataType: "jsonp"
      }
    }
  });

  $("#spreadsheet").kendoSpreadsheet();

  var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
  var sheet = spreadsheet.activeSheet();
  sheet.setDataSource(dataSource, [
      { field: "UnitPrice", title: "Price" },
      { field: "ProductName", title: "Name" }
  ]);

</script>
In this article