forEachCell

Executes a function for each cell in the range.

Parameters

callback Function

The function that will be executed against every cell. The function receives the following parameters:

  • rowIndex - the row index of the cell
  • columnIndex - the column index of the cell
  • cellProperties - the cell properties

Example

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

        $("#spreadsheet").kendoSpreadsheet({
            sheets: [
                { rows: [
                    { cells: [
                        { value: "A1" }, { value: "B1" }
                    ] },
                    { cells: [
                        { value: "A2" }, { value: "B2" }
                    ] }
                ] }
            ]
        });


        var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
        var sheet = spreadsheet.activeSheet();
        var range = sheet.range("A1:B2");

        range.forEachCell(function (row, column, cellProperties) {
        /* The result can be observed in the DevTools(F12) console of the browser. */
            console.log(row, column, cellProperties);
        });
    </script>

In this article