worsksheet.clear() is not clearing the formatting on the cells it is only clearing the values is there a way to clear the foprmating too either on all cells or a specified range
i have tried cellformat bold none and passing it to the format func of gspread but its not working
here is my code that i havev tried
if len(list_of_lists) != 0:
num_rows = len(list_of_lists)
num_cols = len(list_of_lists[0]) if num_rows > 0 else 0
start_cell = 'A1'
end_cell = gspread.utils.rowcol_to_a1(num_rows, num_cols)
print("start cell",start_cell,"end cell:", end_cell)
data_range = f"{start_cell}:{end_cell}"
print("data range",data_range)
clear_format = cellFormat(
backgroundColor=None, # Clear background color
textFormat=textFormat(bold=False, foregroundColor=None), # Reset text format
horizontalAlignment=None # Reset horizontal alignment
)
format_cell_range(worksheet, data_range, clear_format)
worksheet.clear()
print("Formatting cleared")
cleared = True
New contributor
Aryan Sharma is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.