Delete-Row
Command Description
Delete a row from the sheet
Command Prototype
Excel.DeleteRow(objExcelWorkBook,sheet,strCell,bSave)
Parameter Description
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
objExcelWorkBook | True | expression | objExcelWorkBook | Excel workbook object (workbook opened with "Open Excel" command (Excel.OpenExcel) or the workbook object returned by the command "Bind Excel" (Excel.BindBook)) |
sheet | True | string | "Sheet1" | The string means sheet name. The number means sheet order(starting from 0) |
strCell | True | string | "A1" | The specified row, can be positioned using a cell name like 'A1' or directly using a numeric row number |
bSave | True | boolean | None | Save immediately after the operation |
Demo
/************************Delete line************************** ********
**Input 1:
** objExcelWorkBook--Excel workbook object (a workbook opened using the "Open Excel" command (Excel.OpenExcel) or a job bound using the "Bind Excel" command (Excel.BindBook) book object).
**Entry 2:
** sheet--If a string is used, it means the name of the specified worksheet; if a number is used, it means the order of the specified worksheet (starting from 0).
**Entry 3:
** strCell--Specified row, you can use the cell name such as 'A1' to locate, or directly use the numeric row number to locate.
**Entry 4:
** bSave--The operation is completed and saved immediately. (boolean true/false)
**
*********************************************************************/
objExcelWorkBook = Excel.OpenExcel(@res"Test.xlsx",True,"Excel","","")
Excel.DeleteRow(objExcelWorkBook,"Sheet1","A1",False)
TracePrint "Delete row: The row where A1 of the Excel object Sheet1 worksheet is deleted"
Excel.CloseExcel(objExcelWorkBook,True)