Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save smozgur/f85ce0c69b4b145796b2a37e3c31e273 to your computer and use it in GitHub Desktop.
Save smozgur/f85ce0c69b4b145796b2a37e3c31e273 to your computer and use it in GitHub Desktop.
Excel custom function that returns a custom data type.
name: Excel Custom Function - GETARTICLE()
description: Excel custom function that returns a custom data type.
host: EXCEL
api_set: {}
script:
content: |
/**
* @customfunction
* @returns {any}
*/
function getArticle() {
return {
type: "Entity",
text: "Create a Personal Macro Workbook",
properties: {
publishDate: {
type: "FormattedNumber",
basicValue: 44505,
numberFormat: "m/d/yyyy"
},
author: {
type: "Entity",
text: "Bill Jelen",
properties: {
image: {
type: "WebImage",
address: "https://www.mrexcel.com/img/authors/bill-jelen.jpg"
},
books: {
type: "Array",
elements: [
[
{
type: "String",
basicValue: "MrExcel 2021 – Unmasking Excel"
}
],
[
{
type: "String",
basicValue: "MrExcel 2020 - Seeing Excel Clearly"
}
],
[
{
type: "String",
basicValue: "Excel Dynamic Arrays Straight to the Point 2nd Edition"
}
]
]
}
}
},
image: {
type: "WebImage",
address: "https://www.mrexcel.com/img/excel-tips/2021/11/create-a-personal-macro-workbook-sm.jpg"
}
}
};
}
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