3

I'm quite new working with the Office.js API. I created a React add-in project and I'm now trying to add a custom function which can simply add two cells just like the examples at create custom function in Excel. In this guide it says you have to create the add-in project as Excel Custom Functions

So my doubt is how can I create a custom function if the add-in project I created is React type instead of Excel Custom Functions

Romina
  • 195
  • 1
  • 3
  • 12

1 Answers1

1

Yes, you definitely can. Currently, it means merging existing templates (react template and the one at custom functions template which are both available via yo office) and as feature moves out of preview we will have explicit guidance on https://aka.ms/customfunctions.

For now there are 4 things:

  1. modify your manifest to add the customfunctions under the "allformfactors" element
  2. add an customfunctions.html file which can load your JavaScript
  3. add the customfunctions.json file
  4. add a reference to your JavaScript
Henry Ecker
  • 34,399
  • 18
  • 41
  • 57
  • 1
    Is there any example on how to get that merge done? I tried to do the 4 stepts you mention but couldn't reach the `CustomFunction` object in order to do the `associate`. – Romina Jan 17 '19 at 10:28
  • @Keyur Patel - MSFT - Could we get an updated answer to this as the structure of Excel add-in projects have changes since this was posted (there is no longer a customfunctions.json file, ect.). There is still no [yeoman office template](https://github.com/OfficeDev/generator-office#--projecttype) for creating an Excel Custom Functions project with a **React** Taskpane. Attempts I have made to go from a React Taskpane project to adding Custom functions and vice versa (from a Custom Functions project to adding a React Taskpane) have both failed. – Antoine Dahan Jan 12 '22 at 17:29