Skip to content

Instantly share code, notes, and snippets.

@theangkko
Created July 12, 2023 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theangkko/fc3fc5e15e586796814bc659a56e693b to your computer and use it in GitHub Desktop.
Save theangkko/fc3fc5e15e586796814bc659a56e693b to your computer and use it in GitHub Desktop.
OfficeJS-excel custom function by theangkko
name: tgCF
description: |-
OfficeJS-excel custom function
by theangkko
host: EXCEL
api_set: {}
script:
content: >
// $("#run").click(() => tryCatch(run)); // async function run() { //
await Excel.run(async (context) => { // const sheet =
context.workbook.worksheets.getActiveWorksheet(); // console.log("Your
code goes here"); // await context.sync(); // }); // } // /** Default
helper for invoking an action and handling errors. */ // async function
tryCatch(callback) { // try { // await callback(); // } catch
(error) { // // Note: In a production add-in, you'd want to notify the
user through your add-in's UI. // console.error(error); // } // }
/**
* check version
* @customfunction
* @returns {string} check version of add-in.
*/
function version_myGistFunction() {
// return "publish on 2023-05-31, myGistFunction";
return "publish on 2023-05-31, myGistFunction";
}
/** @CustomFunction */
function add10(x: number): number {
return x + 10;
}
/** @CustomFunction */ function sumGist(x: number, y: number): number {
return x + y;
}
language: typescript
libraries: |
https://appsforoffice.microsoft.com/lib/1/hosted/office.js
@types/office-js
office-ui-fabric-js@1.4.0/dist/css/fabric.min.css
office-ui-fabric-js@1.4.0/dist/css/fabric.components.min.css
core-js@2.4.1/client/core.min.js
@types/core-js
jquery@3.1.1
@types/jquery@3.3.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment