2016-11-29 95 views

回答

2

是的,有。这不是非常简单。

这里是隐藏5列的一个示例:

import httplib2 
from apiclient.discovery import build 

credentials = get_credentials() ## See Google's Sheets Docs 
http = credentials.authorize(httplib2.Http()) 

service = build('sheets', 'v4', http=http) 

spreadsheet_id = '#####################' 
sheet_id = '#######' 
requests = [] 

requests.append({ 
    'updateDimensionProperties': { 
    "range": { 
     "sheetId": sheet_id, 
     "dimension": 'COLUMNS', 
     "startIndex": 4, 
     "endIndex": 5, 
    }, 
    "properties": { 
     "hiddenByUser": True, 
    }, 
    "fields": 'hiddenByUser', 
}}) 

body = {'requests': requests} 
response = service.spreadsheets().batchUpdate(
    spreadsheetId=spreadsheet_id, 
    body=body 
).execute() 
相关问题