|

Get Values using getRange(sheet!range)

This post is a corrected post after AI explains the code included in the book “Google Apps Script 101: Building Work Automation For Free”. Added a strikethrough when editing what AI has written, and added color when edited by author

Table of Contents

  1. Summary
  2. Code
  3. Code Explanation
  4. Example
  5. AI Prompt

Summary

In this blog post, we will explore how to retrieve values from a specific range in a Google Spreadsheet using Apps Script. We will use the getRange and getValues methods to retrieve the values in the range ‘시트2!A1:C3’ and log them using the Logger class.

Code

Code Explanation

The code defines a function named getA1C3Values_1. It uses the SpreadsheetApp.getActiveSpreadsheet() method to get the active spreadsheet, and the getRange method to specify the range ‘시트2!A1:C3’. The getValues method is then used to retrieve the values in that range. Finally, the Logger.log statement is used to log the retrieved values.

Example

When the getA1C3Values_1 function is executed, the values in the range ‘시트2!A1:C3’ will be logged in the Apps Script Logger.

AI Prompt

Write a function that retrieves the values from the range ‘시트2!A1:C3’ in a Google Spreadsheet and logs them using the Logger class.

Similar Posts