| name | officejs-advanced-api |
| description | Access Office.js Excel JavaScript API for Excel Add-in development. Use when you need to interact with Excel workbooks, worksheets, ranges, tables, charts, pivot tables, and other Excel objects in the Office Add-in environment. |
| platform | excel |
| ui_visibility | summary |
Office.js Advanced API
Raw Objects
Access the underlying Excel objects:
await Excel.run(async (context) => {
const workbook = context.workbook;
const sheet = workbook.worksheets.getActiveWorksheet();
const range = sheet.getRange("A1:B10");
range.load("values, formulas, format");
await context.sync();
console.log(range.values);
});
API Reference Structure
The type definitions in api-reference.ts contain the Excel namespace (~69K lines):
Excel
├── Application (line ~10410) - App-level settings, calculation mode
├── Workbook (line ~10658) - Workbook operations, protection
├── Worksheet (line ~11188) - Sheet operations, visibility, freeze panes
├── WorksheetCollection (line ~11804) - Add/get/delete sheets
├── Range (line ~12423) - Cell operations, values, formats, formulas
├── RangeAreas (line ~13608) - Non-contiguous ranges
├── NamedItem (line ~14977) - Named ranges/formulas
├── Table (line ~15632) - Structured tables
├── TableCollection (line ~15447) - Add/get tables
├── RangeFormat (line ~16713) - Cell formatting
├── RangeFill (line ~16962) - Background fill
├── RangeFont (line ~17208) - Font styling
├── Chart (line ~17466) - Charts and chart elements
├── ChartCollection (line ~17329) - Add/get charts
├── PivotTable (line ~23316) - Pivot tables
├── ConditionalFormat (line ~25586) - Conditional formatting rules
├── Comment (line ~29418) - Cell comments/notes
├── Shape (line ~29926) - Shapes, images, icons
└── Slicer (line ~31264) - Table/PivotTable slicers
Searching the API
grep -n "class Range extends" api-reference.ts -A 300 | head -150
grep -n "getUsedRange\|getEntireColumn\|getEntireRow" api-reference.ts
grep -n "enum [A-Z]" api-reference.ts | head -50
grep -n "enum HorizontalAlignment" api-reference.ts -A 20
grep -in "conditional\|format" api-reference.ts | head -50
grep -n "interface.*Options\|interface.*Data" api-reference.ts | head -30
Cautions
- Sync is required - Changes aren't applied until
context.sync() is called
- Load before read - Properties must be loaded before accessing them
- Proxy objects - Excel objects are proxies; don't cache them outside
Excel.run
- API Sets - Check
[Api set: ExcelApi X.X] comments for version requirements
Reference