'Copy worksheet to same workbook and rename it using Javascript

I am trying to write a function where a specified workbook is opened and then we need to copy existing sheet and make a copy of it in the same workbook and rename that worksheet. I saw this feature is implemented In VBA using the code below.

Worksheets("Sheet1").Copy After:=Worksheets("Sheet3")

In Javascript I am trying to do

  var xlApp = new ActiveXObject("Excel.Application");
  var xlWorkbooks = xlApp.Workbooks;
  var xlWorkbook = xlWorkbooks.Open(xlFileName);
  var xlWorksheets = xlWorkbook.Worksheets;
  var xlWorkSheet = xlObj.getWorksheet("PRC1.1");
  xlWorkSheet.copy();

This code is creating a copy in new workbook but I want in the same workbook.

Any Answers would be highly appreciated. Thanks in Advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source