Sheet.getRange(1,1,1,12)括号中的数字指定什么? [英] Sheet.getRange(1,1,1,12) what does the numbers in bracket specify?

查看:620
本文介绍了Sheet.getRange(1,1,1,12)括号中的数字指定什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Sheet.getRange(1,1,1,12)

我无法理解参数1,1,1,12.这是什么-工作表ID或行或什么?

I cannot understand the arguments 1,1,1,12 . What is this - the sheet id or row or what?

method getRange(row, column, optNumRows, optNumColumns)

optNumRowsoptNumColumns是什么意思?

推荐答案

  • 行---整数---范围的第一行
  • 列--- int ---范围的最左列
  • optNumRows --- int ---范围内的行数.
  • optNumColumns --- int ---范围内的列数
  • 在您的示例中,您将得到(如果选择了第三行)"C3:O3",原因是C-> O是12列

    In your example, you would get (if you picked the 3rd row) "C3:O3", cause C --> O is 12 columns

    修改

    在文档上使用示例:

    //下面的代码将获取范围C2:G8的列数
    //在活动电子表格中恰好是"4",
    var count = SpreadsheetApp.getActiveSheet().getRange(2,3,6,4).getNumColumns(); Browser.msgBox(count);

    // The code below will get the number of columns for the range C2:G8
    // in the active spreadsheet, which happens to be "4"
    var count = SpreadsheetApp.getActiveSheet().getRange(2, 3, 6, 4).getNumColumns(); Browser.msgBox(count);

    方括号之间的值:
    2:起始行= 2
    3:起始行= C
    6:行数= 6,所以从2到8
    4:cols = 4,所以从C到G

    The values between brackets:
    2: the starting row = 2
    3: the starting col = C
    6: the number of rows = 6 so from 2 to 8
    4: the number of cols = 4 so from C to G

    所以您进入范围:C2:G8

    So you come to the range: C2:G8

    这篇关于Sheet.getRange(1,1,1,12)括号中的数字指定什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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