Skip to content

Instantly share code, notes, and snippets.

@jkpieterse
Created May 17, 2017 14:05
Show Gist options
  • Save jkpieterse/dbdd50dd02631583f2a72d148078ead7 to your computer and use it in GitHub Desktop.
Save jkpieterse/dbdd50dd02631583f2a72d148078ead7 to your computer and use it in GitHub Desktop.
Shared with Script Lab
name: Mutliply range with 5
description: ''
author: jkpieterse
host: EXCEL
api_set: {}
script:
content: |
$("#run").click(run);
async function run() {
try {
await Excel.run(async (context) => {
var i = 0;
var j = 0;
var sht = context.workbook.worksheets.getActiveWorksheet();
await context.sync();
var rng = sht.getRange("B1:K11");
await context.sync();
context.load(rng,"values");
await context.sync();
var results = rng.values;
for (i = 0; i < results.length; i++)
{
for (j = 0; j < results[i].length; j++)
{
results[i][j] = results[i][j] * 5;
};
};
sht.getRange("B14:K24").values = results;
await context.sync();
});
}
catch (error) {
OfficeHelpers.UI.notify(error);
OfficeHelpers.Utilities.log(error);
}
}
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: |
# Office.js
https://appsforoffice.microsoft.com/lib/1/hosted/office.js
# CSS Libraries
[email protected]/dist/css/fabric.min.css
[email protected]/dist/css/fabric.components.min.css
# NPM libraries
[email protected]/client/core.min.js
@microsoft/[email protected]/dist/office.helpers.min.js
[email protected]
# IntelliSense: @types/library or node_modules paths or URL to d.ts files
@types/office-js
@types/core-js
@microsoft/[email protected]/dist/office.helpers.d.ts
@types/jquery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment