Last modified: October 05, 2012

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

In this article
Return Value
Applies To

Gets the Ewa.NamedItemCollection.

var value = Ewa.Workbook.getNamedItems();

The [Ewa.Workbook.getNamedItems] method returns a collection of all named items in the workbook.

The following code example shows how to add a button to the page and then adds an event handler for the button onClick event that loops through all the named items in the workbook and displays the name of each name item in an alert message. The code example assumes that you are working with an Excel Web Access Web Part on SharePoint Server 2013.

<script type="text/javascript">
var ewa = null;
// Add event handler for onload event.
if (window.attachEvent) 
    window.attachEvent("onload", ewaOnPageLoad);    
    window.addEventListener("DOMContentLoaded", ewaOnPageLoad, false); 

// Add event handler for applicationReady event.
function ewaOnPageLoad() 

function onApplicationReady()
    // Get a reference to the Excel Services Web Part
    ewa = Ewa.EwaControl.getInstances().getItem(0);                                   
function getNamedItemsNamesButton()
    // Get the specified workbook.
    var wkBook = ewa.getActiveWorkbook();    
    // Get the NamedItems collection.
    var items = wkBook.getNamedItems();
    for (i=0;i<items.getCount();i++)

<input type="button" id="GetNamedItemsNames" value="Get Named Items Names" onclick="getNamedItemsNamesButton()" />