Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to do ImportRange in 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.

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

like image 217
user1464409 Avatar asked Jun 21 '12 17:06

user1464409


People also ask

How do I get data from another sheet in Google script?

Get data from other sheets in your spreadsheet Open or create a sheet. Select a cell. Type = followed by the sheet name, an exclamation point, and the cell being copied. For example, =Sheet1!

What is the difference between Importrange and Importdata?

What Is the Difference Between IMPORTRANGE and IMPORTDATA? IMPORTRANGE takes a specific range of data from a spreadsheet. IMPORTDATA scrapes data from a URL and imports it as a . CSV or .


1 Answers

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.

like image 101
Serge insas Avatar answered Oct 26 '22 00:10

Serge insas