是否可以在 Google Apps Script 中执行 ImportRange? [英] Is it possible to do ImportRange in Google Apps Script?

查看:31
本文介绍了是否可以在 Google Apps Script 中执行 ImportRange?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天一直在玩 Google Apps Script,我正在尝试编写一些自定义电子表格函数.我进行了一些搜索,但找不到我的查询的答案.

I have been playing around with Google Apps Script today and I am trying to code some custom spreadsheet functions. I have done some searching but cannot find an answer to my query.

我知道在 Google 电子表格上,您可以在电子表格的单元格中使用 ImportRange,如下所示:

I know that on a Google Spreadsheet you can use ImportRange in a cell on a spreadsheet like this:

=ImportRange(spreadsheet_key;sheet!range_of_cells)

我的问题是是否可以在 Google Apps 脚本中执行类似的操作?如果可以,如何操作?

My questions are is it possible to do something similar in a Google Apps Script and if so, how?

我想从另一个电子表格上的工作表(而不是脚本所在的电子表格上的工作表)导入一系列单元格.

I want to import a range of cells from a sheet on another spreadsheet (not a sheet on the spreadsheet where the script will reside).

推荐答案

是的,这是完全可能的.您只需要调用 SpreadsheetApp.openById 然后正常获取所需的工作表和范围.

Yes, this is perfectly possible. You just need to call SpreadsheetApp.openById and then get the desired sheet and ranges normally.

请查看文档:range.getValues()range.setValues() 是非常基本的 GAS 方法,并且描述得很好.

Please take a look at the documentation : range.getValues() and range.setValues() are very basic GAS methods and are pretty well described.

同时阅读教程.

这篇关于是否可以在 Google Apps Script 中执行 ImportRange?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆