6

I just got a change recommendation report for one add-in I submitted. It says Your add-in is not working in the Excel 2013 client on Windows 7 with Internet Explorer 11.

I have always been testing my add-in in Excel 2016 and Excel Online. So I just installed Excel 2013 (version 15.0.4841.1000, which includes SP1), indeed the add-in does not work. But it seems that few things work...

For example, the following example function writes haha in Cell A1 under Excel Online, whereas, it does not anything in Excel 2013.

function test () {
    Excel.run(function (ctx) {
        var range = ctx.workbook.worksheets.getItem("Sheet1").getRange("A1");
        range.values = [["haha"]];
        return ctx.sync();
    });
}

So does anyone know if JavaScript API supports Excel 2013? If not, many professionals will not be able to use add-ins because they are still with Excel 2013...

PS: I see there are lots of add-ins in office store require Excel 2013 or later or Excel 2013 Service Pack 1 or later. If JavaScript API does not support Excel 2013, how have these add-ins (eg, Stock Connector) been developed?

Edit 1: In my manifest xml:

<?xml version="1.0" encoding="UTF-8"?>
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="TaskPaneApp">

In my Home.html, I have:

<script src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js"></script>

Edit 2: I guess the following setting is equivalent to say the add-in is not supposed to be used in Excel 2013?

<Hosts>
  <Host Name="Workbook" />
</Hosts>
<Requirements>
  <Sets>
    <Set Name="ExcelApi" MinVersion="1.2"/>
  </Sets>
</Requirements>
<DefaultSettings>
  ...
</DefaultSettings>
SoftTimur
  • 5,630
  • 38
  • 140
  • 292

2 Answers2

10

When you use the Office.js APIs, you will see that each method is annotated with an API set designation. For example:

enter image description here

These API sets correspond to what versions of Office the add-in will work on. The list of requirement sets, and where they're supported, can be found at http://dev.office.com/reference/add-ins/office-add-in-requirement-sets.

Any of the new Office 2016 host-specific API sets (ExcelApi, WordApi, etc.) are only supported on Excel 2016+ (and Office Online and Mac/iOS equivalents). The API version number (1.1 vs. 1.2 vs. 1.3) corresponds to updates to the APIs, that were added past the RTM build of Office 2016 (which shipped with 1.1 out-of-the-box). Those updates are available to customers who have an Office 365 subscription (home or business). Customers who bought a disk/MSI product of Office 2016 will only have the original 1.1 APIs.

You can use the requirement sets in two ways. If your add-in 100% depends on a particular API set, you should list it in your manifest file. That way, the add-in won't even be proffered on the "Insert/Manage Add-ins" dialog for Office versions that don't support that particular API set.

On the other hand, if you're only using a few APIs in the set, and could do without (even if it's a bit of a degraded experience), you can do the "light-up scenario". That is, you will list the lowest possible version that you do need, and then use a runtime check to detect whether a particular API set is available.

Concrete example: suppose you have an Excel Add-in that creates a new sheet and outputs data into a table. This requires ExcelApi 1.1 version or higher. Ideally you would also like to be able to set the column widths, but range.format.columnWidth is only available in ExcelApi 1.2. You don't want to block customers from using your Add-in if they have an old version -- after all, the bulk of your functionality will still work, even if not optimally -- but you do want to make use of the new APIs. In that case, you should specify ExcelApi 1.1 in your manifest, and then do a runtime check in you JavaScript to determine if you can run the range.format.columnWidth code. I.e.:

if (Office.context.requirements.isSetSupported("ExcelApi", 1.2 )
{
   range.format.columnWidth = 25;
}

For a related answer, see Neat ways to get environment (i.e. Office version)

Community
  • 1
  • 1
  • I have added some information in the OP. I don't think at the moment I am using `ExcelApi`, am I? I am trying to make IntelliSense work via another thread, otherwise could you tell me which method in the example of the OP is not supported by Excel 2013? – SoftTimur Jul 18 '16 at 16:50
  • 1
    If you have "Excel.run" in your method (as you do), or are using an object like Range (which is under the namespace Excel.Range, as IntelliSense will show you), you are definitely using ExcelApi 1.1+. Again, see the IntelliSense bubble (or, if you're not getting IntelliSense, see a question that I just answered: http://stackoverflow.com/a/38442944/678505) – Michael Zlatkovsky - Microsoft Jul 18 '16 at 17:47
  • It seems that I should use another set of functions to make the add-in work for Excel 2013, and it is not impossible; at the moment I will submit what I have for Excel 2016. I just updated the OP, does the manifest look OK? – SoftTimur Jul 18 '16 at 19:19
  • 1
    Yep, that looks right. I don't know if you need `DefaultMinVersion="1.2"`, if it's not required I would leave it off. – Michael Zlatkovsky - Microsoft Jul 18 '16 at 21:48
  • @MichaelZlatkovsky-Microsoft very valuable information (clearer than in the [official documentation](https://learn.microsoft.com/en-us/office/dev/add-ins/reference/requirement-sets/excel-api-requirement-sets)). Perhaps this is off-topic, but why would MS not provide support for stand alone / msi versions and only for Office 365? I mean, how this benefits the final user if they are always stuck in a past `API` version? (such in your example with 2016 msi only being able to use version `1.1`) – rellampec Nov 10 '18 at 23:02
  • @rellampec, for the documentation part, might I recommend you provide feedback to the documentation team via the "Feedback" link at the very bottom of the article, https://learn.microsoft.com/en-us/office/dev/add-ins/reference/requirement-sets/excel-api-requirement-sets#feedback? For your other question, it comes down to the maintenance cost of doing things in the frozen-in-time MSI codebase rather than in the evergreen Office 365. But note that Office 2019 MSI does snap to a much newer set of APIs (I believe ExcelApi 1.8 and WordApi 1.3). – Michael Zlatkovsky - Microsoft Nov 13 '18 at 16:38
1

Excel 2013 supports some things, but there's lots that it doesn't support, including anything using Excel.run().

http://dev.office.com/reference/add-ins/office-add-in-requirement-sets

lgaud
  • 2,430
  • 20
  • 30