File tree Expand file tree Collapse file tree
samples/excel/preview-apis Expand file tree Collapse file tree Original file line number Diff line number Diff line change 14491449 https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/99-just-for-fun/color-wheel.yaml
14501450 group : Just For Fun
14511451 api_set :
1452- ExcelApi : ' 1.4'
1452+ ExcelApi : ' 1.4'
1453+ - id : excel-custom-functions-sync
1454+ name : Synchronous custom function
1455+ fileName : synchronous-function.yaml
1456+ description : >-
1457+ A synchronous custom function that reads a cell value in tandem with Excel's
1458+ calculation process.
1459+ rawUrl : >-
1460+ https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/preview-apis/synchronous-function.yaml
1461+ group : Preview APIs
1462+ api_set :
1463+ CustomFunctionsRuntime : 1.5
Original file line number Diff line number Diff line change 14501450 group : Just For Fun
14511451 api_set :
14521452 ExcelApi : ' 1.4'
1453+ - id : excel-custom-functions-sync
1454+ name : Synchronous custom function
1455+ fileName : synchronous-function.yaml
1456+ description : >-
1457+ A synchronous custom function that reads a cell value in tandem with Excel's
1458+ calculation process.
1459+ rawUrl : >-
1460+ https://raw.githubusercontent.com/OfficeDev/office-js-snippets/main/samples/excel/preview-apis/synchronous-function.yaml
1461+ group : Preview APIs
1462+ api_set :
1463+ CustomFunctionsRuntime : 1.5
Original file line number Diff line number Diff line change 1+ order : 9
2+ id : excel-custom-functions-sync
3+ name : Synchronous custom function
4+ description : A synchronous custom function that reads a cell value in tandem with Excel's calculation process.
5+ host : EXCEL
6+ api_set :
7+ CustomFunctionsRuntime : 1.5
8+ script :
9+ content : |
10+ /**
11+ * Gets the value of a cell, evaluated synchronously with Excel's calculation.
12+ * @customfunction
13+ * @supportSync
14+ * @param {string} address The cell address, e.g. "A1"
15+ * @param {CustomFunctions.Invocation} invocation
16+ * @returns {Promise<any>} The cell value.
17+ */
18+ async function getCellValue(address: string, invocation: CustomFunctions.Invocation): Promise<any> {
19+ const context = new Excel.RequestContext();
20+ context.setInvocation(invocation as any);
21+ const range = context.workbook.worksheets.getActiveWorksheet().getRange(address);
22+ range.load("values");
23+ await context.sync();
24+ return range.values[0][0];
25+ }
26+ language : typescript
27+ libraries : |
28+ https://appsforoffice.microsoft.com/lib/beta/hosted/office.js
29+ https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/types/office-js-preview/index.d.ts
Original file line number Diff line number Diff line change 149149 "excel-just-for-fun-gradient" : " https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/99-just-for-fun/gradient.yaml" ,
150150 "excel-just-for-fun-path-finder-game" : " https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/99-just-for-fun/path-finder-game.yaml" ,
151151 "excel-just-for-fun-tetrominos" : " https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/99-just-for-fun/tetrominos.yaml" ,
152- "excel-just-for-fun-color-wheel" : " https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/99-just-for-fun/color-wheel.yaml"
152+ "excel-just-for-fun-color-wheel" : " https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/99-just-for-fun/color-wheel.yaml" ,
153+ "excel-custom-functions-sync" : " https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/preview-apis/synchronous-function.yaml"
153154}
Original file line number Diff line number Diff line change 149149 "excel-just-for-fun-gradient" : " https://raw.githubusercontent.com/OfficeDev/office-js-snippets/main/samples/excel/99-just-for-fun/gradient.yaml" ,
150150 "excel-just-for-fun-path-finder-game" : " https://raw.githubusercontent.com/OfficeDev/office-js-snippets/main/samples/excel/99-just-for-fun/path-finder-game.yaml" ,
151151 "excel-just-for-fun-tetrominos" : " https://raw.githubusercontent.com/OfficeDev/office-js-snippets/main/samples/excel/99-just-for-fun/tetrominos.yaml" ,
152- "excel-just-for-fun-color-wheel" : " https://raw.githubusercontent.com/OfficeDev/office-js-snippets/main/samples/excel/99-just-for-fun/color-wheel.yaml"
152+ "excel-just-for-fun-color-wheel" : " https://raw.githubusercontent.com/OfficeDev/office-js-snippets/main/samples/excel/99-just-for-fun/color-wheel.yaml" ,
153+ "excel-custom-functions-sync" : " https://raw.githubusercontent.com/OfficeDev/office-js-snippets/main/samples/excel/preview-apis/synchronous-function.yaml"
153154}
You can’t perform that action at this time.
0 commit comments