sheets.columns Array

The column configuration.

sheets.columns.autoWidth Boolean (default: false)

If set to true, the column will stretch to fit the contents of all cells.

Example - enabling the auto width

  <script>
  var workbook = new kendo.ooxml.Workbook({
    sheets: [
        {
            columns: [ { autoWidth: true } ],
            rows: [
              { cells: [ { value: "short" } ] },
              { cells: [ { value: "longer text value" } ] }
            ]
        }
    ]
  });
workbook.toDataURLAsync().then(function(dataURL) {
  kendo.saveAs({
    dataURI: dataURL,
    fileName: "Test.xlsx"
  });
});
  </script>

sheets.columns.index Number

The zero-based index of the column in the sheet. Defaults to the index of the object in the array.

Example - setting the width of the second column

  <script>
  var workbook = new kendo.ooxml.Workbook({
    sheets: [{
        columns: [{
            width: 100,
            index: 1
        }]
    }]
  });
workbook.toDataURLAsync().then(function(dataURL) {
  kendo.saveAs({
    dataURI: dataURL,
    fileName: "Test.xlsx"
  });
});
  </script>

sheets.columns.width Number

The width (in pixels) of the column.

Example - setting the column widths

<script>
var workbook = new kendo.ooxml.Workbook({
  sheets: [
      {
          columns: [ { width: 100 }, { width: 200 } ],
          rows: [
            {
              cells: [
                { value: "this column is 100px" }, { value: "this column is 200px" }
              ]
            }
          ]
      }
  ]
});
workbook.toDataURLAsync().then(function(dataURL) {
  kendo.saveAs({
    dataURI: dataURL,
    fileName: "Test.xlsx"
  });
});
</script>
In this article