Ewa.RangeChangeEventArgs Object

SharePoint 2013

Last modified: October 04, 2012

Applies to: apps for SharePoint | Excel Services | SharePoint Server 2013

An object that you can use to both access other objects related to a given instance of the event, and to get and set data, such as values that are contained in the associated range.


Use the methods of the Ewa.RangeChangeEventArgs object to get the values of the cells in the range, to get a reference to the range itself, or to get a reference to the workbook that contains the range. Additionally, you can use the Ewa.RangeChangeEventArgs.getEwaControl() method to get the Ewa.EwaControl Object object that represents the Excel Web AccessExcel Web Access Web Part.

The following code example shows how to subscribe an event handler to the dataEntered event. When the dataEntered event fires it invokes each subscribed event handler with a Ewa.RangeChangeEventArgs object as the only argument. The code example shows how to use the Ewa.RangeChangeEventArgs to retrieve information about the range associated with the event. Also, the code example assumes that you are working with Excel Web Access Web Parts on SharePoint Server 2013.

<script type="text/javascript">
var ewa = null;

// Run the Excel load handler on page load
if (window.attachEvent) {
    window.attachEvent("onload", loadEwaOnPageLoad);
} else {
    window.addEventListener("DOMContentLoaded", loadEwaOnPageLoad, false);

// Event handler for page load event 
function loadEwaOnPageLoad() {
    if (typeof (Ewa) != "undefined") {
        // Retrieve workbook from SharePoint location when EWA is ready
    else {
        alert("Error - the EWA is not loaded.");
    // ...

function ewaApplicationReady() {
    // Get a reference to the EWA web part that represents the Ewa web part
    // in SharePoint:
    ewa = Ewa.EwaControl.getInstances().getItem(0);

    var sheets = ewa.getActiveWorkbook().getSheets();
    var sheet;

    // Add the event handler to every sheet in the workbook
    for (i = 0; i < sheets.getCount(); i++) {
        sheet = sheets.getItem(i);

function addDataEnteredHandler(rangeChangeArgs) {
    var sheetName = rangeChangeArgs.getRange().getSheet().getName();
    var col = rangeChangeArgs.getRange().getColumn();
    var row = rangeChangeArgs.getRange().getRow();
    var value = rangeChangeArgs.getFormattedValues();
    alert("The range was located at row " + (row + 1) + " and column " + (col + 1) + " with value " + "\"" + value + "\"" + ".");