Created
November 13, 2017 09:56
-
-
Save bohtho/4d9d4d3f8183ab4ca74a6747fb71fa79 to your computer and use it in GitHub Desktop.
Executes a basic Excel API call using the "common API" syntax (compatible with Office 2013). - Shared with Script Lab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Basic API call (Office 2013) | |
description: Executes a basic Excel API call using the "common API" syntax (compatible with Office 2013). | |
author: bohtho | |
host: EXCEL | |
api_set: {} | |
script: | |
content: | | |
$("#run").click(run); | |
function run() { | |
Office.context.document.getSelectedDataAsync(Office.CoercionType.Text, (asyncResult) => { | |
if (asyncResult.status === Office.AsyncResultStatus.Failed) { | |
console.log(asyncResult.error.message); | |
} else { | |
console.log(`The selected data is "${asyncResult.value}".`); | |
} | |
}); | |
} | |
language: typescript | |
template: | |
content: | | |
<button id="run" class="ms-Button"> | |
<span class="ms-Button-label">Run</span> | |
</button> | |
language: html | |
style: | |
content: "/* Your style goes here */\r\n" | |
language: css | |
libraries: | | |
https://appsforoffice.microsoft.com/lib/1/hosted/office.js | |
https://appsforoffice.microsoft.com/lib/1/hosted/office.d.ts | |
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 | |
@microsoft/office-js-helpers@0.7.4/dist/office.helpers.min.js | |
@microsoft/office-js-helpers@0.7.4/dist/office.helpers.d.ts | |
jquery@3.1.1 | |
@types/jquery |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment