Forum Discussion
shankar_r
9 years agoCommunity Hero
Hi,
You can do like below,
excelObject = Sys.OleObject("Excel.Application");
excelWorkbookObj = excelObject.Workbooks.Open(<strexcelFileName>);
excelMainSheet = excelWorkbookObj.Sheets.Item("<Your sheet name>");
excelMainSheet.UsedRange.ClearContents //this will only clear contents
excelMainSheet.Cells.Clear //this will clear everything