Forum Discussion

hina's avatar
hina
Contributor
3 years ago

Deleting a Column in Excel

Hi,

 

How can I delete a column in excel, The code below doesn't work 

 

function Test1()
{
var excelFile = Excel.Open("C:\\ELink\\Logs\\testlogs.xlsx");
var excelSheet = excelFile.SheetByTitle("Sheet1");

excelSheet.Range("2:2").Delete; // This doesn't work

excelFile["Save"]();

}

 

Any help would be appreciated.

 

Thanks,

Hina

2 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    My own preference is to skip unneeded data rather than deleting it. What are you trying to do in your test?

    • hina's avatar
      hina
      Contributor

      I am trying to compare 2 excel files, both excel files have datetime column that I don't want to compare. The tool I am using doesn't skip the column it compares the files as it is. So before using that tool, I am trying to get rid of datetime column from both excel files. Is there a way to delete the column through TestComplete.

       

      Thanks,

      Hina