Ejemplo n.º 1
0
    def __is_strikethrough(self, task_list):
        options = ('вых', 'свободная ячейка', 'не занимать', 'болен')
        result = []

        for task in task_list:
            if task.lower() in options:
                result.append(False)
                continue
            task_address = self.sheet.find(task).address
            res = gspread_formatting.get_effective_format(self.sheet, task_address)
            result.append(res.textFormat.strikethrough)
        return result
Ejemplo n.º 2
0
 def conditional_format_sheet(self, sheet, template_sheet, template_header):
     apreciacao_list = self.get_column_values(sheet, 'Situação',
                                              template_header)
     for row, cell in enumerate(apreciacao_list, start=1):
         coord = xl_rowcol_to_cell(
             row, template_header['Situação']['column_index'])
         if 'pauta' in cell.lower():
             cell_formatting = gs_formatting.get_effective_format(
                 sheet, coord)
             cell_formatting.textFormat.foregroundColor =\
                 gs_formatting.color(1, 0, 0)
             gs_formatting.format_cell_range(sheet, coord + ':' + coord,
                                             cell_formatting)
Ejemplo n.º 3
0
 def get_template_header_formatting(self, template_sheet):
     if self.header_exists(template_sheet):
         sheet_data = template_sheet.get_all_values()
         template_header_formatting = {}
         for template_sheet_col, cell in enumerate(sheet_data[0], start=0):
             cell_coordinate = xl_rowcol_to_cell(0, template_sheet_col)
             template_header_formatting[cell] = {
                 'coord':
                 cell_coordinate,
                 'formatting':
                 gs_formatting.get_effective_format(template_sheet,
                                                    cell_coordinate),
                 'column_index':
                 template_sheet_col
             }
         return template_header_formatting
     else:
         return False
Ejemplo n.º 4
0
wks = gc.open("1nCyw-9KB1Ut07BNQ8_zQLVvrScOZvkKPMAorcu5Ad2U").sheet1

# WORKSHEET ACTIONS

wks.update_title("Sheet 1")

# FETCH THE DATA
cell_list = wks.range('A2:D4')

# UPDATE VALUE (ROW/COL)
wks.update_acell('D2', "TRUE")
wks.update_cell(4, 1, 'TRUE')  # TRUE AS A CHECKBOX

# UPDATE FORMAT OF CELL - SUING GSPREAD_FORMATTING MODULE

fmt = get_effective_format(wks, 'A1')

fmt = cellFormat(backgroundColor=color(1, 0.5, 0.5),
                 textFormat=textFormat(bold=True,
                                       foregroundColor=color(0.4, 0, 1)))

format_cell_range(wks, 'A1:A10', fmt)

# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly']

# The ID and range of a sample spreadsheet.
SAMPLE_SPREADSHEET_ID = '1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms'
SAMPLE_RANGE_NAME = 'Class Data!A2:E'

MY_SPREADSHEET_ID = '1nCyw-9KB1Ut07BNQ8_zQLVvrScOZvkKPMAorcu5Ad2U'
Ejemplo n.º 5
0
    def is_strike_current(self, task):
        cell = self.sheet.find(task).address
        result = gspread_formatting.get_effective_format(self.sheet, cell)

        return result.textFormat.strikethrough