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

    Interface IExternalBook

    A cached snapshot of another workbook, referenced from a formula as [n]Sheet1!$A$1.

    Excel's external link is not a live reference — it is the cache plus enough to go re-fetch the source. See the design doc for the full model: private-assets/design/calc/DESIGN-EXTERNAL-LINKS.md.

    Two members read as "which book is this", and they answer different questions:

    member answers persisted unique
    getSources WHERE the source file is yes, in the file no — two books can both be Budget.xlsx
    getId WHICH book this is, to us no, minted per load yes

    They cannot collapse into one: a path cannot be the key, because two books may share one — hence a runtime id that is not one. getDisplayName is a projection of getSources, not a third identity.

    A book has no position member. The n in [n] is where the SOURCE FILE stores this book in its list, it renumbers when another book is removed, and no surface the reader sees spells one — so it belongs to IExternalBookCollection, which is what orders them, and not to the book.

    A book is immutable. Adding, removing and breaking one are the collection's operations (IExternalBookCollection); what a book itself answers beyond its snapshot is getDependents — which formulas cite it.

    interface IExternalBook {
        isIExternalBook: true;
        breakLink(txOptions?: ITransaction.OperationOptions): void;
        delete(txOptions?: ITransaction.OperationOptions): void;
        getDefinedNames(): readonly DefinedNameEntry[];
        getDependents(): readonly Coords[];
        getDisplayName(sheetName?: string | null): string;
        getId(): string;
        getSheetData(sheetIndex: number): SheetData | null;
        getSheetNames(): readonly string[];
        getSources(): readonly SourceEntry[];
        refresh(): Promise<RefreshResult>;
        toJSON?(): IExternalBook.JSON | null;
    }
    Index
    isIExternalBook: true

    For runtime type checking.

    • Excel's Break Link: every cell formula that cites this book becomes its current values (the whole formula, not only the external operand), then the book is removed. One undoable step.

      Parameters

      Returns void

      A defined name that cites the book is left as it is and images as #REF! afterwards. IExternalBookCollection.breakAll is this for every book. A book that is already gone is left alone.

    • Removes this book, renumbering every later [n]. One undoable step.

      Parameters

      Returns void

      A formula still citing the book is NOT rewritten: it keeps the slot's id, images as #REF! and computes #REF! — so an undo, which brings the slot and its id back, heals it. To turn citations into values first, as Excel's Break Links does, use breakLink. A book that is already gone is left alone.

    • The source book's own defined names, as seen at cache time — raw text, as the part spells it.

      Returns readonly DefinedNameEntry[]

      refersTo is what Excel cached: a leading = and quoted sheet names of the SOURCE (='Data Sheet'!$B$2), #REF! for a name that held an expression rather than a reference, and never a sheetId — Excel flattens a sheet-scoped source name into the book's namespace. Kept verbatim; the engine compiles it inside the book ([1]!Name computes from the cache).

    • Every formula block that cites this book — directly, through a sheet of it, or as [n]!Name.

      Returns readonly Coords[]

      Derived from the compiled formulas, never stored: the same index a defined name's dependents come from, so it is exact and current after any edit. A block on a sheet has that sheet's stable id as its scope; a block whose scope is a defined name's id is that name's body, which cites the book on behalf of everything that uses the name. A block citing the book through two sheets is listed once.

      Empty until the calculation engine has compiled the workbook's formulas.

    • How a scope into this book SPELLS, unquoted — Excel's source-closed form (C:\dir\[Budget.xlsx]Sheet1) while the book is closed, its source-open form ([Budget.xlsx]Sheet1) once a resolver holds it.

      Parameters

      • OptionalsheetName: string | null

        Omitted for the book-scoped [1]!Name form.

      Returns string

      A readout of the book's state, not a preference — see DESIGN-EXTERNAL-LINKS §4B. Until phase E there is no resolver, so this is always the closed form. The caller quotes it.

    • Which book this is, to us — stable for the life of the workbook and never persisted.

      Returns string

      [n] is a POSITION, not a key: removing a book renumbers every citation after it. So a compiled formula stores this id, and the [n] is projected from the collection's ordering (the collection's ordering) whenever canonical text is produced. Same arrangement NamedFormulaCollection uses for a named formula. Minted at construction; a .sxl round trip mints new ones.

    • The cached cell values for one of the book's sheets, or null if that sheet was never cached.

      Parameters

      • sheetIndex: number

        Position in getSheetNames, matching the XML's sheetId (0-based).

      Returns SheetData | null

      Sparse. A cell the cache does not hold — and a sheet it holds nothing for — reads as a BLANK cell, which is what Excel computes with the source closed (design doc §6 items 1/2). Values only — no format, no style, no comment; a cached date is a plain serial (§2.5).

    • The source book's sheet names, in its own order — the ONLY names the book is known by.

      Returns readonly string[]

      [n]Sheet1!... addresses a sheet by its position in THIS list, not by a stable id — the source workbook has no idea SheetXL exists.

    • Where the source workbook is — read from this book's own part relationships.

      Returns readonly SourceEntry[]

      An ORDERED list, not one path with optional alternates: a book can carry several at once (externalLinkPath, xlExternalLinkPath/xlPathMissing, externalLinkLongPath and the xxl21 alternateUrls extension are all instances of this one shape), and the entry the book is opened from is sorted first. A LOCATION, never a key — two books can both be Budget.xlsx, which is exactly why getId exists.

      Deliberately NOT an IWorkbookIO.Origin: an origin is a live, listenable handle the IO layer owns and can write back to, and this is a dead (relType, target) pair the source file recorded. Turning one into the other is what a phase-E locator does.

    • Re-reads this book from its source and replaces the cache — Excel's Refresh on a row of the Workbook Links pane.

      Returns Promise<RefreshResult>

      Needs a resolver (ICellContainerOptions.externalBookResolver, given when the workbook is built); without one every book is 'unavailable' and nothing changes, which is the state a workbook is in until a host supplies one (DESIGN-EXTERNAL-LINKS §4D). A replaced cache is one undoable step, and every formula citing the book reads the new values. A resolver that throws leaves the cache as it was and marks each cached sheet refreshError, as Excel records a refresh it could not complete.