python - Remove only formating on a cell range selection with google spreadsheet API -
i looking way remove formating on cell range selection, not content, using google sheet api python.
for now, solution have apply same logic normal format , setting style none. example, when set border format specifical range, use :
request_dict = {'requests': [{ "updateborders": { "range": { "sheetid": sheetid, "startrowindex": 1, "endrowindex": raws, "startcolumnindex": first_col, "endcolumnindex": last_col}, "top": { "style": "solid_medium", "width": 1, "color": {"blue": 0}}, "bottom": { "style": "solid_medium", "width": 1, "color": {"blue": 0}}, "left": { "style": "solid_medium", "width": 1, "color": {"blue": 0}}, "right": { "style": "solid_medium", "width": 1, "color": {"blue": 0}}, "innerhorizontal": { "style": "solid_medium", "width": 1, "color": {"blue": 0}}, "innervertical": { "style": "solid_medium", "width": 1, "color": {"blue": 0}}}}]} body = {'requests': request_dict['requests']} service.spreadsheets().batchupdate(spreadsheetid=spreadsheetid, body=body).execute()
and if want delete it, replace "style" field 'none' :
request_dict = {'requests': [{ "updateborders": { "range": { "sheetid": sheetid, "startrowindex": 1, "endrowindex": raws, "startcolumnindex": first_col, "endcolumnindex": last_col}, "top": { "style": "none", "width": 1, "color": {"blue": 0}}, "bottom": { "style": "none", "width": 1, "color": {"blue": 0}}, "left": { "style": "none", "width": 1, "color": {"blue": 0}}, "right": { "style": "none", "width": 1, "color": {"blue": 0}}, "innerhorizontal": { "style": "none", "width": 1, "color": {"blue": 0}}, "innervertical": { "style": "none", "width": 1, "color": {"blue": 0}}}}]} body = {'requests': request_dict['requests']} service.spreadsheets().batchupdate(spreadsheetid=spreadsheetid, body=body).execute()
but means need define function erase format each kind of format define, not practical... first step find way erase formatting on whole sheet, , maybe after able specifical range in sheet.
wiki
Comments
Post a Comment