1

We have an Excel 365 Add-In, which is using Document.getFileAsync (because it is the only way to access the complete spreadsheet, without requiring the user to select it).

This API is not available in Desktop Excel (neither 2013 nor 2016).

How we are supposed to handle the MS complaint on Office Store certification, that the App is not running in Desktop Excel?

Is it enough to include

<Requirements>
 <Sets>
  <Set Name="File" />
 </Sets>
 <Methods>
  <Method Name="Document.getFileAsync" />
 </Methods>
</Requirements>

in the manifest?

Testing shows that Excel is ignoring this options (at least when the manifest is coming form a local folder).

Or are we supposed to implement a second code path (with a different UI), that requires the user to select the complete spreadsheet, so that we can export it via getDataAsync for Desktop Excel?

How can find out, if we are embedded in Excel Desktop or Excel Online?

Ruediger Jungbeck
  • 2,836
  • 5
  • 36
  • 59

1 Answers1

1

You seem to have a typo in your manifest, it should read

<Method Name="Document.getFileAsync" />

And not

<Method Name="Doument.getFileAsync" />

In any case, I'd encourage you to take a look at Worksheet.GetUsedRange, which allows you to retrieve the range that encompass all the data of a worksheet as in the following sample :

var ctx = new Excel.RequestContext();
var sheetUsedRange = ctx.workbook.worksheets.getActiveWorksheet().getUsedRange();
sheetUsedRange.load('values');
ctx.sync().then(function() {
    console.log(sheetUsedRange.values);
});

Now, to answer your question on how to know whether you're embedded in Excel Desktop or Excel online, I'd suggest looking a Michael Zlatkovsky's answer on that matter.

Gabriel Royer

Developer on the Office Extensibility Team, MSFT

Community
  • 1
  • 1
Gab Royer
  • 9,587
  • 8
  • 40
  • 58
  • The typo was only in the SO post, not in the manifest that was rejected on certifcation. Is the Worksheet GetUsedRange API (and the others used in your example) available in Excel 2013? Is it available Online? How do we check for its availability? – Ruediger Jungbeck Oct 13 '15 at 09:34
  • 1
    I'm afraid Worksheet.GetUsedRange is only available on Excel 2016, although it is available on both Desktop and Online. This API, along with all of the new Excel APIs are in the "ExcelApi" API set version 1.1. – Gab Royer Oct 13 '15 at 18:16
  • I have tried your Excel.RequestContext based approach in Excel Online. It does not show any error, but it never calls the "then" function. Any ideas? – Ruediger Jungbeck Nov 02 '15 at 14:11
  • After further investigation, it would seem like the APIs aren't enabled yet in Excel Online, although they should be before the end of the year. Sorry for the confusion. – Gab Royer Nov 02 '15 at 18:04