I have a workbook that I would like to clear a range of values with using OpenPyXI. So far I have the following:
# Import OpenPyXl module.
from openpyxl impo
import openpyxl
book = openpyxl.load_workbook('sample.xlsx') #get the file name
sheet = book.get_sheet_by_name('Sheet') #get the sheet name
for a in sheet['A1':'A2']: #you can set the range here
for cell in a:
cell.value = None #set a value or null here
book.save('sample.xlsx') #you can save it after if you like