VBScript to Delete a Particular row in an EXCELSHEET :QTP Scripting

QTP Script to delete a specific row in an ExcelSheet.

Check This Script to get Excelsheet row count and column count in QTP

We have Excelsheet with following values

A B C
11 lak QTP
22 lax LR
33 laxmi WR
44 lakshmi QC

Set aa = CreateObject("Excel.Application")
Set bb = aa.Workbooks.Open("C:\es.xls")
Set cc = aa.worksheets("Sheet1")
cc.Rows(1).Delete
bb.Save
aa.Workbooks.Close()

Above script deletes first row of excelsheet.

After running the script excelsheet will have following values.

A B C
22 lax LR
33 laxmi WR
44 lakshmi QC

Similarly to delete 3 row(just replace 1 with 3 in the above script).

Set aa = CreateObject("Excel.Application")
Set bb = aa.Workbooks.Open("C:\es.xls")
Set cc = aa.worksheets("Sheet1")
cc.Rows(3).Delete
bb.Save
aa.Workbooks.Close()

QTP Script to export database data to excel sheet
VBScript to Check Whether Particular File Exists or Not.
Check this Post for Datatable Methods.
Excel Sheet Creation and Writing Data Into It
Data Driven Using Excel Sheet
Data Driven Using Notepad
Movie Songs Lyrics
SQL Queries Collection
Read Specific cell value from excel sheet using VBScript in QTP.

Related Posts Plugin for WordPress, Blogger...

Fun and Knowledge