Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents the Excel application process.

Hierarchy

  • ExcelApplication

Index

Properties

adapter

adapter: ExcelAdapter

Native adapter process being used.

Methods

addEventListener

  • Adds a listener for the specified application-level event.

    throws

    AdapterError if an exception is thrown by the native adapter process, typically by the Excel PIA.

    throws

    EventError if specified event is not supported.

    Parameters

    • eventName: string

      Type of the application-level event to listen for.

    • listener: WorkbookCreatedEventListener

      Function called when the specified event occurs.

    Returns Promise<void>

  • Adds a listener that is called when a workbook is created.

    throws

    AdapterError if an exception is thrown by the native adapter process, typically by the Excel PIA.

    Parameters

    • eventName: "createWorkbook"

      Name of the event fired when a workbook is created.

    • listener: WorkbookCreatedEventListener

      Listener function called when the event occurs.

    Returns Promise<void>

calculateFull

  • calculateFull(): Promise<void>
  • Triggers calculation for all open workbooks.

    Only necessary when the calculation mode is not set to Automatic.

    Returns Promise<void>

createWorkbook

  • Creates a new Excel workbook.

    throws

    AdapterError if an exception is thrown by the native adapter process, typically by the Excel PIA.

    Returns Promise<ExcelWorkbook>

    The workbook that was created.

getCalculationMode

  • Get the current calculation mode which determines when a workbook or worksheet is calculated.

    Note: This function requires that the actual Excel application must be running.

    throws

    AdapterError if Excel is not running.

    Returns Promise<ExcelCalculationMode>

    The name of the current calculation mode.

getWorkbooks

  • Gets all workbooks currently open in Excel.

    throws

    AdapterError if an exception is thrown by the native adapter process, typically by the Excel PIA.

    Returns Promise<ExcelWorkbook[]>

    All currently open workbooks.

openWorkbook

  • Opens a workbook from a given file path.

    If the workbook file is already open in Excel, the existing Excel window will be given focus.

    throws

    AdapterError if no workbook file was found at the given file path, or if an exception is thrown by the native adapter process, typically by the Excel PIA.

    Parameters

    • filePath: string

      Absolute path where the workbook file is located.

    Returns Promise<ExcelWorkbook>

    The workbook that was opened.

quit

  • quit(displayAlerts?: boolean): Promise<void>
  • Quits Excel closing all open workbooks in the process.

    If any open workbooks have unsaved changes, Excel displays a "Save" prompt before closing the workbook. You can prevent this by either saving all open workbooks prior to calling quit or by setting the displayAlerts parameter to false (be careful doing this though, any unsaved workbook changes will be lost).

    Note: After calling this function, do not attempt to use any existing workbook or worksheet objects. Doing so will likely result in an AdapterError since the underlying object/file is no longer available.

    throws

    AdapterError if an exception is thrown by the native adapter process, typically by the Excel PIA.

    Parameters

    • Optional displayAlerts: boolean

      Determines whether Excel will display a "Save" prompt for any workbooks with unsaved changes (defaults to true).

    Returns Promise<void>

removeEventListener

  • Removes a previously added listener for the specified application-level event.

    throws

    AdapterError if an exception is thrown by the native adapter process, typically by the Excel PIA.

    throws

    EventError if provided listener function does not match any added event listener.

    Parameters

    Returns Promise<void>

Generated using TypeDoc