Access via:
io.excelAPIinterface
Excel API.
Properties (2)
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| addinStatus⚓︎ | boolean | x | Flag indicating the status of the Excel Adapter.
If |
|
| sheets⚓︎ | Sheet[] | x | Retrieves all Excel worksheets currently tracked by the Excel Adapter, including worksheets opened by the app and worksheets discovered in Excel. |
6 Methods
onAddinStatusChanged()⚓︎
(callback: (connected: boolean) => void) => UnsubscribeFunction
Notifies when the Excel Adapter status has changed. Returns an unsubscribe function.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| callback⚓︎ | (connected: boolean) => void | Callback function for handling the event. Receives as an argument a Boolean value indicating the status of the Excel Adapter. |
Example
office.excel.onAddinStatusChanged((connected) => {
if (connected) {
console.log("Excel is available");
} else {
console.log("Excel is closed or addin is not working");
}
});
openSheet()⚓︎
(sheetData: OpenSheetConfig) => Promise<Sheet>
Opens a new Excel worksheet.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| sheetData⚓︎ | OpenSheetConfig | Configuration for opening the Excel worksheet. |
Example
const options = {
columnConfig: [
{ header: "Symbol", fieldName: "symbol" },
{ header: "Price", fieldName: "price" },
],
data: [
{ price: 100, symbol: "AAPL" },
{ price: 200, symbol: "GOOG" },
],
options: {
workbook: "MyWorkbook",
worksheet: "MyWorksheet",
},
};
const mySheet = await office.excel.openSheet(options);
console.log(mySheet);