Clone Excel Spreadsheet

Clones the contents of a worksheet of an Excel file.

Command availability: IBM RPA SaaS and IBM RPA on premises

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

excelCloneWorksheet --file(Excel) --worksheet(String) --newworksheet(String) (Boolean)=value

Dependencies

  • To use this command, open an Excel file with the Open Excel file (excelopen) command.

Input parameters

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
Excel file Required Excel Variable that stores the Excel instance.
Worksheet worksheet Required Text Name of the worksheet in the Excel file that should be cloned.
New Worksheet newworksheet Required Text Name of the new worksheet.

Output parameters

Designer mode label Script mode name Accepted variable types Description
Success value Boolean Returns True if the worksheet has been cloned successfully, or False otherwise.

Example

The Open Excel File command opens an Excel file and stores it in the variable "excelFile". The Clone Excel Spreadsheet command clones a spreadsheet named "plan1", inside the Excel file, and assigns the name "newSheet" to the cloned worksheet. In the end, the Log Message command tells the user if the operation was successful.

defVar --name excelFile --type Excel
defVar --name success --type Boolean
excelOpen --file "samplefile" excelFile=value
excelCloneWorksheet --file ${excelFile} --worksheet worksheetname --newworksheet newSheet success=value
excelClose --file ${excelFile} --save
logMessage --message "${success}" --type "Info"
//Result: success: True

Important: To run the sample script, you must create the excel file and name the first sheet as "Plan1", then, enter the path where the file was saved in the Open Excel File (excelopen) command.