Esempio n. 1
0
def make_sheet_banded(worksheet: Worksheet, df: pd.DataFrame):
    col_vals = df.columns.values
    xl_cols_dict = [{'header': col} for col in df.columns.values]
    last_col_letter = excel_columns()[len(col_vals) - 1]
    xl_last_data_row = df.shape[0] + 1  # plus 1 is because data starts at row 2
    table_style = {
        'banded_rows': True,
        'header_row': True,
        'columns': xl_cols_dict,
        'style': 'Table Style Light 16'
    }

    worksheet.add_table(f'A1:{last_col_letter}{xl_last_data_row}', table_style)