ExcelScript.LinkedWorkbook interface

Contains information about a linked workbook. If a workbook has links pointing to data in another workbook, the second workbook is linked to the first workbook. In this scenario, the second workbook is called the "linked workbook".

Methods

breakLinks()

Makes a request to break the links pointing to the linked workbook. Links in formulas are replaced with the latest fetched data. The current LinkedWorkbook object is invalidated and removed from LinkedWorkbookCollection.

refreshLinks()

Makes a request to refresh the data retrieved from the linked workbook.

Method Details

Makes a request to break the links pointing to the linked workbook. Links in formulas are replaced with the latest fetched data. The current LinkedWorkbook object is invalidated and removed from LinkedWorkbookCollection.

breakLinks(): void;

Returns

void

Examples

/**
 * This script removes all links to other workbooks.
 */
function main(workbook: ExcelScript.Workbook) {
    // Get all the linked workbook references.
    const externalWorkbooks: ExcelScript.LinkedWorkbook[] = workbook.getLinkedWorkbooks();
    console.log(`There are ${externalWorkbooks.length} other workbooks linked to from this workbook.`);

    // Remove all the links to those workbooks.
    // This changes the value of cells with workbook links to "#CONNECT!".
    externalWorkbooks.forEach((workbookLink) => {
        workbookLink.breakLinks();
    });
}

Makes a request to refresh the data retrieved from the linked workbook.

refreshLinks(): void;

Returns

void