def protected_range( *, spreadsheet_id: sheet.ID, editor_emails: Optional[List[str]] = None, warning_only: bool = False, description: Optional[str] = None, row_start_index: Optional[int] = None, row_end_index: Optional[int] = None, column_start_index: Optional[int] = None, column_end_index: Optional[int] = None, tab_id: int = 0, sheets_service: Optional[discovery.Resource] = None, ) -> None: """ Protect range so only provided users can edit. """ request = protected_range_request( editor_emails=editor_emails, warning_only=warning_only, description=description, row_start_index=row_start_index, row_end_index=row_end_index, column_start_index=column_start_index, column_end_index=column_end_index, tab_id=tab_id, ) sheet.batch_update( spreadsheet_id, requests=[request], sheets_service=sheets_service )
def dropdown_options( *, spreadsheet_id: sheet.ID, options: List[str], row_start_index: Optional[int] = None, row_end_index: Optional[int] = None, column_start_index: Optional[int] = None, column_end_index: Optional[int] = None, tab_id: int = 0, sheets_service: Optional[discovery.Resource] = None, ) -> None: """ Add dropdown data validation - must be a member of the list. """ request = dropdown_options_request( options=options, row_start_index=row_start_index, row_end_index=row_end_index, column_start_index=column_start_index, column_end_index=column_end_index, tab_id=tab_id, ) sheet.batch_update( spreadsheet_id, requests=[request], sheets_service=sheets_service )
def rename( *, spreadsheet_id: sheet.ID, tab_name: str, tab_id: int = 0, sheets_service: discovery.Resource = None, ) -> None: """ Rename specified tab. """ request = rename_request(tab_name=tab_name, tab_id=tab_id) sheet.batch_update(spreadsheet_id, requests=[request], sheets_service=sheets_service)
def new( *, spreadsheet_id: sheet.ID, tab_name: str, tab_id: Optional[int] = None, sheets_service: discovery.Resource = None, ) -> None: """ Create a new tab with given name. """ request = new_request(tab_name=tab_name, tab_id=tab_id) sheet.batch_update(spreadsheet_id, requests=[request], sheets_service=sheets_service)
def freeze( spreadsheet_id: sheet.ID, *, num_rows: int = 0, num_columns: int = 0, tab_id: int = 0, sheets_service: Optional[discovery.Resource] = None, ) -> None: """ Freeze rows and column from the leftmost corner outwards. """ request = freeze_request(num_rows=num_rows, num_columns=num_columns, tab_id=tab_id) sheet.batch_update( spreadsheet_id, requests=[request], sheets_service=sheets_service )
def auto_resize( spreadsheet_id: sheet.ID, *, start_column_index: int = 0, end_column_index: int = 20, tab_id: int = 0, sheets_service: Optional[discovery.Resource] = None, ) -> None: """ Automatically resize columns to their largest value. """ request = auto_resize_request( start_column_index=start_column_index, end_column_index=end_column_index, tab_id=tab_id, ) sheet.batch_update( spreadsheet_id, requests=[request], sheets_service=sheets_service )
def hide_columns( spreadsheet_id: sheet.ID, *, hidden: bool = True, start_column_index: Optional[int] = None, end_column_index: Optional[int] = None, tab_id: int = 0, sheets_service: Optional[discovery.Resource] = None, ) -> None: """ Hide the columns for provided column range. """ request = hide_columns_request( start_column_index=start_column_index, end_column_index=end_column_index, hidden=hidden, tab_id=tab_id, ) sheet.batch_update( spreadsheet_id, requests=[request], sheets_service=sheets_service )
def alternating_colors( spreadsheet_id: sheet.ID, *, row_start_index: Optional[int] = None, row_end_index: Optional[int] = None, column_start_index: Optional[int] = None, column_end_index: Optional[int] = None, tab_id: int = 0, sheets_service: Optional[discovery.Resource] = None, ) -> None: """ Add alternating colors, with special header coloring. """ request = alternating_colors_request( row_start_index=row_start_index, row_end_index=row_end_index, column_start_index=column_start_index, column_end_index=column_end_index, tab_id=tab_id, ) sheet.batch_update( spreadsheet_id, requests=[request], sheets_service=sheets_service )