Skip to content

Instantly share code, notes, and snippets.

View EX 5.EXCEL.yaml
name: EX 5
description: ''
host: EXCEL
api_set: {}
script:
content: |
const form = document.getElementById("form") as HTMLFormElement;
form.addEventListener("submit", async (event) => {
event.preventDefault();
View EX 4.EXCEL.yaml
name: EX 4
description: ''
host: EXCEL
api_set: {}
script:
content: >
const form = document.getElementById("form") as HTMLFormElement;
const field1 = document.getElementById("field1") as HTMLInputElement;
@VlT0R
VlT0R / EX 03.EXCEL.yaml
Created Jun 10, 2021
Create a new snippet from a blank template.
View EX 03.EXCEL.yaml
name: EX 03
description: Create a new snippet from a blank template.
host: EXCEL
api_set: {}
script:
content: "const run = document.getElementById(\"run\");\r\nrun.addEventListener(\"click\", async () => {\r\n await Excel.run(async (context) => {\r\n const folha1 = context.workbook.worksheets.getActiveWorksheet();\r\n let folha2 = context.workbook.worksheets.getItemOrNullObject(\"Inverter\");\r\n let folha3 = context.workbook.worksheets.getItemOrNullObject(\"Alfabetico\");\r\n if (folha2 || folha3) folha2.delete(), folha3.delete();\r\n folha2 = context.workbook.worksheets.add(\"Inverter\");\r\n folha3 = context.workbook.worksheets.add(\"Alfabetico\");\r\n\r\n const range1 = folha1.getRange(\"A1\").getExtendedRange(\"Down\");\r\n range1.load([\"Values\", \"rowCount\"]);\r\n await context.sync();\r\n\r\n const range2 = folha2.getRange(`A1:A${range1.rowCount}`);\r\n const range3 = folha3.getRange(`A1:A${range1.rowCount}`);\r\n range3.values = range1.values;\r\n range2.va
@VlT0R
VlT0R / EX 2.EXCEL.yaml
Last active Jun 10, 2021
Create a new snippet from a blank template.
View EX 2.EXCEL.yaml
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();
@VlT0R
VlT0R / EX 1 .yaml
Last active Jun 10, 2021
EXERCICIO 1 -10/06/2021
View EX 1 .yaml
name: Blank snippet (3)
description: Create a new snippet from a blank template.
host: EXCEL
api_set: {}
script:
content: "const prepare = document.getElementById(\"prepare\") as HTMLButtonElement;\r\n\r\nconst calc = document.getElementById(\"calc\") as HTMLButtonElement;\r\n\r\ncalc.addEventListener(\"click\", async () => {\r\n await Excel.run(async (context) => {\r\n const sheet = context.workbook.worksheets.getActiveWorksheet();\r\n\r\n const inputRange = sheet.getRange(\"B2:B6\");\r\n const inputResult = sheet.getRange(\"A1:B1\");\r\n\r\n inputRange.load(\"values\");\r\n await context.sync();\r\n\r\n const n1 = parseFloat(inputRange.values[0][0]);\r\n const n2 = parseFloat(inputRange.values[1][0]);\r\n const n3 = parseFloat(inputRange.values[2][0]);\r\n const n4 = parseFloat(inputRange.values[3][0]);\r\n const n5 = parseFloat(inputRange.values[4][0]);\r\n\r\n \r\n\r\n\r\n let max;\r\n let min;\r\n\r\n if (n1>n2 && n1>n3 && n1>n4 && n1>n5) {\r\n max = n1;\