0

In the article List of Perl commands to manipulate Windows Excel with Win32::OLE module it is mentioned how to add an Excel WorkSheet before or after an existing WorkSheet!

I want to move, so change the position of an existing WorkSheet, before or after an other WorkSheet. How can I achieve this? Is it just to replace the add in $Book->Worksheets->Add({After => $workbook->Worksheets($workbook->Worksheets->{Count})}); by move (or copy if I want to copy)?

thank you for your hints! Regards Laurent

Laurent Zotto
  • 37
  • 1
  • 7

1 Answers1

1

You need to use the Worksheet.Move method with the After attribute

I am not a perl specialist, but the syntax should be:

$Book->Worksheets("Sheet1")->Move({After => $workbook->Worksheets($workbook->Worksheets("Sheet2"))});
xMRi
  • 14,982
  • 3
  • 26
  • 59