Get values and formulas of a workbook by JavaScript API for Excel 2013?

ms-office office-js

101 просмотра

1 ответ

1595 Репутация автора

I often need to collect the values and formulas of the usedRange of all the worksheets. I am wondering how to do this by JavaScript API for Excel 2013.

It seems that the only way to get/read data is via binding. There are for example MatrixBindings and TableBindings. But I don't see how to bind to a fixed area (let's say A1:Z1000 of Sheet1).

Could anyone help?

Автор: SoftTimur Источник Размещён: 18.07.2016 08:56

Ответы (1)

0 плюса

2511 Репутация автора


Here's a way to get the values in a named range in Excel 2013:

var myBindings = Office.context.document.bindings;
myBindings.addFromNamedItemAsync("Sheet1!A1:Z1000", "matrix", {}, function (asyncResult) {
    asyncResult.value.getDataAsync(function (asyncResult2) {

There isn't any way to get the formulas in 2013.

I should note the smaller API set available for Excel 2013 isn't really designed for getting the entire contents of sheets, but the above code will still work for this narrow case.

-Michael Saunders (Program Manager for add-ins in Office)

Автор: Michael Saunders Размещён: 18.07.2016 09:21
Вопросы из категории :