Is each range update in spreadsheets.values.batchUpdate() in Google Sheet API a Request call

3 views
Skip to first unread message

Isaac via StackOverflow

unread,
Jan 20, 2017, 12:09:06 AM1/20/17
to google-appengin...@googlegroups.com

This is my code below using the batchUpdate

SHEET.spreadsheets().values().batchUpdate(spreadsheetId=ea_form_spreadsheet_id, body=bodys).execute()

In the "bodys" :

data = [
    {
        'range': staff_name + '!AE3',
        'majorDimension': 'ROWS',
        'values': ae3_values
    },
    {
        'range': staff_name + '!E4',
        'majorDimension': 'ROWS',
        'values': e4_values
    },
    {
        'range': staff_name + '!Z4',
        'majorDimension': 'ROWS',
        'values': z4_values
    },
    {
        'range': staff_name + '!AE3',
        'majorDimension': 'ROWS',
        'values': ae3_values
    },
    {
        'range': staff_name + '!AE3',
        'majorDimension': 'ROWS',
        'values': ae3_values
    },
    {
        'range': staff_name + '!AE3',
        'majorDimension': 'ROWS',
        'values': ae3_values
    },
    {
        'range': staff_name + '!Q9',
        'majorDimension': 'ROWS',
        'values': q9_values
    },
    {
        'range': staff_name + '!F11',
        'majorDimension': 'ROWS',
        'values': f11_values
    },
    {
        'range': staff_name + '!H12:H13',
        'majorDimension': 'COLUMNS',
        'values': h_values
    },
    {
        'range': staff_name + '!AI11:AI16',
        'majorDimension': 'COLUMNS',
        'values': ai_values
    },
    {
        'range': staff_name + '!AK21',
        'majorDimension': 'ROWS',
        'values': ak21_values
    },
    {
        'range': staff_name + '!AK46:AK47',
        'majorDimension': 'COLUMNS',
        'values': ak_values
    },
    {
        'range': staff_name + '!AJ57:AK58',
        'majorDimension': 'COLUMNS',
        'values': aj_values
    },
    {
        'range': staff_name + '!C71',
        'majorDimension': 'ROWS',
        'values': c71_values
    },
    {
        'range': staff_name + '!V67',
        'majorDimension': 'ROWS',
        'values': v67_values
    }
]

body = {
    'valueInputOption': 'USER_ENTERED',
    'data': data
    }

So I will like to know if each of this range update is a request call or it is been summed up to just one Request Call.. in other words, what is the difference between spreadsheets.values.batchUpdate and spreadsheets.values.update



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/41756464/is-each-range-update-in-spreadsheets-values-batchupdate-in-google-sheet-api-a

Mr.Rebot via StackOverflow

unread,
Jan 22, 2017, 9:49:06 AM1/22/17
to google-appengin...@googlegroups.com

As stated in each description of spreadsheets.values.batchUpdate and spreadsheets.values.update, one function sets values in one or more ranges of a spreadsheet and the other Sets values in a range of a spreadsheet respectively.

Based from the documentation - Updating Spreadsheets : Batch update operations

The batchUpdate method works by taking one or more Request objects, each one specifying a single kind of request to perform. There are many different kinds of requests.

A very good explanation of batch request is in Drive API:

A batch request consists of multiple API calls combined into one HTTP request. Batching Requests reduce the number of HTTP connections your client has to make.

Hope this information helps.



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/41756464/is-each-range-update-in-spreadsheets-values-batchupdate-in-google-sheet-api-a/41792308#41792308
Reply all
Reply to author
Forward
0 new messages