An object that represents an open workbook in Excel.

Hierarchy

  • ExcelWorkbook

Properties

getName: (() => Promise<string>)

Type declaration

    • (): Promise<string>
    • Gets the workbook name.

      Returns

      The workbook name.

      Throws

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

      Returns Promise<string>

Methods

  • Activates the first window associated with the workbook, bringing it in to focus.

    Activating a workbook deactivates the currently activated workbook.

    Returns Promise<void>

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

    Throws

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

    Throws

    EventError if specified event is not supported.

    Parameters

    • eventName: string

      Type of the workbook-level event to listen for.

    • listener: ExcelWorkbookEventListener

      Function called when the specified event occurs.

    Returns Promise<void>

  • Adds a listener that is called when the workbook is activated.

    Throws

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

    Parameters

    • eventName: "activate"

      Name of the event fired when the workbook is activated.

    • listener: WorkbookActivatedEventListener

      Listener function called when the event occurs.

    Returns Promise<void>

  • Adds a listener that is called when a worksheet is added to the workbook.

    Throws

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

    Parameters

    • eventName: "addWorksheet"

      Name of the event fired when a worksheet is added to the workbook.

    • listener: WorksheetAddedEventListener

      Listener function called when the event occurs.

    Returns Promise<void>

  • Adds a listener that is called when the workbook is closed.

    Throws

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

    Parameters

    • eventName: "close"

      Name of the event fired when the workbook is closed.

    • listener: WorkbookClosedEventListener

      Listener function called when the event occurs.

    Returns Promise<void>

  • Adds a listener that is called when the workbook is deactivated (i.e. another workbook is activated).

    Throws

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

    Parameters

    • eventName: "deactivate"

      Name of the event fired when the workbook is deactivated.

    • listener: WorkbookDeactivatedEventListener

      Listener function called when the event occurs.

    Returns Promise<void>

  • Adds a listener that is called when a worksheet is deleted from the workbook.

    Throws

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

    Parameters

    • eventName: "deleteWorksheet"

      Name of the event fired when a worksheet is deleted from the workbook.

    • listener: WorksheetDeletedEventListener

      Listener function called when the event occurs.

    Returns Promise<void>

  • Adds a new worksheet to the workbook.

    Returns

    The worksheet that was created.

    Throws

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

    Returns Promise<ExcelWorksheet>

  • Triggers calculation for the entire workbook.

    Only necessary when automatic calculation is turned off.

    Throws

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

    Returns Promise<void>

  • Closes the workbook.

    If the workbook has any unsaved changes, Excel displays a "Save" prompt before closing the workbook.

    After calling this function do not attempt to use this workbook or any child 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 adapter process, typically by the Excel PIA.

    Returns Promise<void>

  • Get the current calculation mode which determines when the workbook is re-calculated.

    Returns

    The name of the current calculation mode.

    Throws

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

    Returns Promise<ExcelCalculationMode>

  • Gets a worksheet with a given name.

    Returns

    The worksheet matching the provided name, or null if no matching worksheet was found.

    Throws

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

    Parameters

    • worksheetName: string

      The name of the worksheet to get.

    Returns Promise<null | ExcelWorksheet>

  • Gets all worksheets belonging to the workbook.

    Returns

    All worksheets belonging to the workbook.

    Throws

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

    Returns Promise<ExcelWorksheet[]>

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

    Throws

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

    Throws

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

    Parameters

    Returns Promise<void>

  • Saves the workbook to disk.

    Returns

    The full path the workbook was saved to.

    Throws

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

    Returns Promise<string>

  • Saves the workbook to the file path provided.

    Returns

    The full path the workbook was saved to.

    Throws

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

    Parameters

    • filePath: string

      Full path (including file name) where the workbook should be saved.

    Returns Promise<string>

Generated using TypeDoc