0 out of 1 rated this helpful - Rate this topic

TableData.rows property (apps for Office)

apps for Office

Published: February 26, 2013

Gets or sets the rows in the table.

var myRows = tableBindingObj.rows;

Returns an array of arrays that contains the data in the table. Returns an empty array[], if there are no rows.

To specify rows, you must specify an array of arrays that corresponds to the structure of the table. For example, to specify two rows of string values in a two-column table you would set the row property to [['a', 'b'], ['c', 'd']].

If you specify null for the rows property (or leave the property empty when you construct a TableData object), the following results occur when your code executes:

  • If you insert a new table, a blank row will be inserted.

  • If you overwrite or update an existing table, the existing rows are not altered.

The following example creates a single-column table with a header and three rows.

function createTableData() {
    var tableData = new Office.TableData();
    tableData.headers = [['header1']];
    tableData.rows = [['row1'], ['row2'], ['row3']];
    return tableData;
}

Supported clients

Excel 2013, Excel Web App, Word 2013

Library

Office.js

Namespace

Office

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.