-1
from openpyxl import load_workbook
wb = load_workbook("C:\op.xlsx")
ws = wb.active

This is the code I have so far as I don't know what to do next so pls help me.

Shrahbeel
  • 21
  • 6

1 Answers1

2

Try:

ws.delete_rows(1, ws.max_row)

You could also delete the sheet and create another one:

del wb[wb.active.title]
wb.create_sheet()

See

GordonAitchJay
  • 4,640
  • 1
  • 14
  • 16