Delete Content Of Particular Excel Cells Python
I have the following Excel sheet with the following cells: 'A' 'B' 'C' 1 S 2 T 2 E F D 3 K L M 4 N D F 5 P E M I w
Solution 1:
Found out the solution. Maybe someone else would need it:
import openpyxl
wb=openpyxl.load_workbook('/media/sf_vboxshared/x.xlsx')
sheet=wb.get_sheet_by_name('Sheet1')
list=['2','F','L']
j=len(list)
for j inrange(1,j+1):
sheet.cell(row=j, column=2).value=None
And to check the output can be used:
for rowOfCellObjects in sheet['A1':'D6']:
for cellObj in rowOfCellObjects:
print(cellObj.coordinate, cellObj.value)
Best regards, Dan
Post a Comment for "Delete Content Of Particular Excel Cells Python"