I use xlwingson Windows (Excel 2007 with Python 2.7) and would like to remove ranges or columns with xlwings. As far as I could see, deleting a range or column is a missing function, so I tried following the instructions below and tried to access the .DeleteRange object method in VBA. Do you have any suggestions on what causes the error, and how to remove the range of whole columns in xlwings?
The code I tried to run on the command line is below (to delete the entire column in the active workbook):
import xlwings as xw
wb = xw.Workbook.active()
xw.Range('C1:C3').xl_range.EntireColumn.Delete
I got the following error:
bound method CDispatch.Delete of <COMObject <unknown>>>
xlwingswill offer the option to clear values from a range (by Range('C1:C3').clear()), but this will leave an empty sheet or column on the sheet.