Options
All
  • Public
  • Public/Protected
  • All
Menu

An object that represents an open workbook in Excel.

Hierarchy

  • ExcelWorkbook

Index

Methods

  • activate(): Promise<void>
  • 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.

    throws

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

    Returns Promise<ExcelWorksheet>

    The worksheet that was created.

  • calculate(): Promise<void>
  • 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>

  • close(): 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.

    throws

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

    Returns Promise<ExcelCalculationMode>

    The name of the current calculation mode.

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

    throws

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

    Returns Promise<string>

    The workbook name.

  • getWorksheetByName(worksheetName: string): Promise<null | ExcelWorksheet>
  • Gets a worksheet with a given name.

    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>

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

  • Gets 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[]>

    All worksheets belonging to the workbook.

  • 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>

  • save(): Promise<string>
  • Saves the workbook to disk.

    throws

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

    Returns Promise<string>

    The full path the workbook was saved to.

  • saveAs(filePath: string): Promise<string>
  • Saves the workbook to the file path provided.

    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>

    The full path the workbook was saved to.

Generated using TypeDoc