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

问题描述

我今天一直在使用Google Apps脚本,并试图编写一些自定义电子表格函数。我已经做了一些搜索,但无法找到我的查询的答案。



我知道在Google Spreadsheet中,您可以在电子表格的单元格中使用ImportRange:

  = ImportRange(spreadsheet_key; sheet!range_of_cells)

我的问题是可以在Google Apps脚本中做类似的事情吗?如果是这样,怎么做?



我想从另一个电子表格上的工作表导入一系列单元格(不是电子表格中脚本所在的工作表)。 是的,这是完全可能的。您只需调用 SpreadsheetApp.openById ,然后正常获取所需的工作表和范围。



请查看: range.getValues() range.setValues()是非常基本的GAS方法,描述。



阅读教程也是如此。


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.

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)

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).

解决方案

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

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

Read the tutorial as well.

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

08-19 22:45