ExcelScript.LinkedWorkbook interface

包含有关链接工作簿的信息。 如果工作簿具有指向另一个工作簿中的数据的链接,则第二个工作簿将链接到第一个工作簿。 在此方案中,第二个工作簿称为“链接工作簿”。

方法

breakLinks()

发出断开指向链接工作簿的链接的请求。 公式中的链接将替换为最新提取的数据。 当前 LinkedWorkbook 对象无效并从 中删除 LinkedWorkbookCollection

refreshLinks()

发出刷新从链接工作簿检索到的数据的请求。

方法详细信息

发出断开指向链接工作簿的链接的请求。 公式中的链接将替换为最新提取的数据。 当前 LinkedWorkbook 对象无效并从 中删除 LinkedWorkbookCollection

breakLinks(): void;

返回

void

示例

/**
 * 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();
    });
}

发出刷新从链接工作簿检索到的数据的请求。

refreshLinks(): void;

返回

void