SheetXL - v0.8.0-beta.9+sites.210.e2d420901
    Preparing search index...

    Function useWorkbookApp

    • Single-call setup for a single-per-window workbook app: resolves the workbook ONCE (an explicit source, the ?source URL query, or a blank workbook) and manages the window chrome (document/tab title with an unsaved marker, an unsaved-changes close prompt, and a browser keyboard guard).

      Parameters

      Returns IWorkbook | Promise<IWorkbook>

      the workbook (an IWorkbook or a Promise<IWorkbook>) to hand to the view (@sheetxl/react!WorkbookElement or Studio). The view awaits the same promise, so the workbook loads once and the chrome + the view observe the same instance.

      For apps that own the whole window — NOT for embedding a workbook as a widget. Read failures reject the returned promise (so the view's error panel shows) rather than yielding a null workbook; a DECLINED open — a dismissed picker or a cancelled password prompt — is not a failure and yields the same blank workbook a session with no source gets.

      const workbook = useWorkbookApp();              // reads ?source, else a blank workbook
      return <Studio workbook={workbook} />; // or <WorkbookElement workbook={workbook} />