Sheet.getRange(1,1,1,12) what does the numbers in bracket specify?

前端 未结 1 1571
眼角桃花
眼角桃花 2020-12-13 06:33
Sheet.getRange(1,1,1,12)

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

meth         


        
相关标签:
1条回答
  • 2020-12-13 07:13

    Found these docu on the google docu pages:

    • row --- int --- top row of the range
    • column --- int--- leftmost column of the range
    • optNumRows --- int --- number of rows in the range.
    • optNumColumns --- int --- number of columns in the range

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

    edit

    Using the example on the docu:

    // 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);

    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

    So you come to the range: C2:G8

    0 讨论(0)
提交回复
热议问题