Excel JavaScript API 概述Excel JavaScript API overview

Excel 加载项通过使用 Office JavaScript API 与 Excel 中的对象进行交互,JavaScript API 包括两个 JavaScript 对象模型:An Excel add-in interacts with objects in Excel by using the Office JavaScript API, which includes two JavaScript object models:

  • Excel JavaScript APIExcel JavaScript API 随 Office 2016 一起引入,提供了强类型的对象,可用于访问工作表、区域、表格、图表等。Excel JavaScript API: Introduced with Office 2016, the Excel JavaScript API provides strongly-typed objects that you can use to access worksheets, ranges, tables, charts, and more.

  • 通用 API通用 API 随 Office 2013 引入,可用于访问多种类型的 Office 应用程序中常见的 UI、对话框和客户端设置等功能。Common APIs: Introduced with Office 2013, the Common API can be used to access features such as UI, dialogs, and client settings that are common across multiple types of Office applications.

文档的本部分着重介绍了 Excel JavaScript API,它可用于开发面向 Excel 网页版或 Excel 2016 或更高版本的加载项中的大部分功能。This section of the documentation focuses on the Excel JavaScript API, which you'll use to develop the majority of functionality in add-ins that target Excel on the web or Excel 2016 or later. 有关通用 API 的信息,请参阅常见 JavaScript API 对象模型For information about the Common API, see Common JavaScript API object model.

了解编程概念Learn programming concepts

有关重要编程概念的信息,请参阅以下文章:See the following articles for information about important programming concepts:

了解 API 功能Learn about API capabilities

阅读此文档部分中的其他文章,了解如何处理事件图表区域表格工作表等。Use other articles in this section of the documentation to learn about working with events, charts, ranges, tables, worksheets, and more. 在此部分中,你还可以找到有关 Excel JavaScript API 概念的指南,例如使用 Excel 加载项共同创作数据验证错误处理性能优化Also in this section, you'll find guidance about Excel JavaScript API concepts such as coauthoring in Excel add-ins, data validation, error handling, and performance optimization. 有关可用文章的完整列表,请参阅目录。See the table of contents for the complete list of available articles.

有关使用 Excel JavaScript API 访问 Excel 中对象的实际经验,请完成 Excel 加载项教程For hands-on experience using the Excel JavaScript API to access objects in Excel, complete the Excel add-in tutorial.

有关 Excel JavaScript API 对象模型的详细信息,请参阅 Excel JavaScript API 参考文档For detailed information about the Excel JavaScript API object model, see the Excel JavaScript API reference documentation.

试用 Script Lab 中的代码示例Try out code samples in Script Lab

使用 Script Lab 快速熟悉一系列展示如何使用 API 完成任务的内置示例。Use Script Lab to get started quickly with a collection of built-in samples that show how to complete tasks with the API. 你可以运行 Script Lab 中的示例来立即查看任务窗格或工作表中的结果,检查示例来了解 API 的工作原理,甚至可以使用示例来构建自己的加载项的原型。You can run the samples in Script Lab to instantly see the result in the task pane or worksheet, examine the samples to learn how the API works, and even use samples to prototype your own add-in.

另请参阅See also