1

与在 Eclipse 中使用常规 Java 代码相比,使用 Google Apps 脚本与 Google Sheets 交互有哪些优势?

4

1 回答 1

10

Well, the first advantage is that you don't need to install Java or Eclipse or any other library. With any modern browser that you already use to access the Spreadsheet, you may write Apps Script code.

Second, you don't need to worry with authentication, i.e. Client Login, AuthSub, oAuth, oAuth2, etc. Apps Script handles the authentication process seamless for you.

Apps Script also have a "tighter" integration with Google Spreadsheets (and Documents). It has many features that are not available on the regular Spreadsheet API. For example, it can add menus to the Spreadsheet interface, set up triggers to run the script whenever a cell is edited or a form is submitted. When running from a custom menu or an "image button" on the spreadsheet, Apps Script can show nice custom UIs to any user on the spreadsheet.

There's also methods to apply formatting to spreadsheet cells, merge/unmerge cells, set fronzen rows and columns, protect sheets, add charts, images, etc (which I think are not present on the Spreadsheet API v3, but I might be wrong).

Apps Script runs on the cloud and does not depend on your computer or any installation process. Once you've setup a script to interact with a spreadsheet (via menus or triggers), any user that edit that spreadsheet can interact with the script. There's no need to install anything else and your computer can be off.

Apps Script is much easier than Java, with multiple libraries and versions, classpaths and IDE's setup. Anyone can start using it, does not require a skilled developer to set it up, any savvy user is up for the task.

于 2012-11-29T11:19:34.443 回答