Create a new snippet from a blank template.
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: EX 2 | |
description: Create a new snippet from a blank template. | |
host: EXCEL | |
api_set: {} | |
script: | |
content: | | |
const form = document.getElementById("run") as HTMLFormElement; | |
form.addEventListener("click", async (event) => { | |
event.preventDefault(); | |
await Excel.run(async (context) => { | |
const sheet = context.workbook.worksheets.getFirst(); | |
const colunA = sheet.getRange("A1").getExtendedRange("Down"); | |
colunA.load(["values", "rowCount"]); | |
await context.sync(); | |
const forumla = []; | |
for (let i = 0; i < colunA.rowCount; i++) { | |
const v = colunA.values[i][0]; | |
const quadra = v * v; | |
const raiz = Math.sqrt(v); | |
forumla.push([quadra, raiz]); | |
} | |
const qer = sheet.getRange(`B1:C${colunA.rowCount}`); | |
qer.values = forumla; | |
await context.sync(); | |
}); | |
}); | |
language: typescript | |
template: | |
content: "<form id=\"run\">\n\t<button>Executar</button>\n\t</div>" | |
language: html | |
style: | |
content: '' | |
language: css | |
libraries: | | |
https://appsforoffice.microsoft.com/lib/1/hosted/office.js | |
@types/office-js | |
core-js@2.4.1/client/core.min.js | |
@types/core-js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment