使用python隐藏google工作表中的行
我想使用python隐藏文档中的行,以对项目进行身份验证,但我尝试使用spread,没有选择使用python隐藏google工作表中的行,python,google-sheets-api,gspread,Python,Google Sheets Api,Gspread,我想使用python隐藏文档中的行,以对项目进行身份验证,但我尝试使用spread,没有选择 因此,我想知道是否有可能使用python来实现这一点,我相信您的目标和您目前的情况如下 您希望在Google电子表格中隐藏工作表的行 您希望通过python的gspread使用Sheets API来实现这一点 您已经能够使用Sheets API和gspread 在这种情况下,我认为你的目标可以实现使用的方法。当这反映到脚本中时,它将变成如下所示 示例脚本: 当运行上述脚本时,Google电子表格s
因此,我想知道是否有可能使用python来实现这一点,我相信您的目标和您目前的情况如下
- 您希望在Google电子表格中隐藏工作表的行
- 您希望通过python的gspread使用Sheets API来实现这一点
- 您已经能够使用Sheets API和gspread
- 当运行上述脚本时,Google电子表格
中“Sheet1”的第2到10行将被隐藏spreadsheetId
- 此示例脚本假定您已经能够使用带有gspread的Sheets API获取和输入Google电子表格的值。请小心这个
client = gspread.authorize(credentials) # Please use your authorization script for this.
spreadsheetId = "###" # Please set your Spreadsheet ID.
sheetName = "Sheet1" # Please set the sheet name.
spreadsheet = client.open_by_key(spreadsheetId)
sheetId = spreadsheet.worksheet(sheetName).id
body = {
"requests": [
{
"updateDimensionProperties": {
"properties": {
"hiddenByUser": True
},
"range": {
"sheetId": sheetId,
"dimension": "ROWS",
"startIndex": 1,
"endIndex": 10
},
"fields": "hiddenByUser"
}
}
]
}
spreadsheet.batch_update(body)