Copy Excel workbook

This pre-built action in Avo Assure under @Excel element instructs Avo Assure Client to copy one Excel file’s content to another.

Syntax:

Input: <FilePath1> ;<FilePath2> ;< Option> (Optional) ;< text/special> (Optional)

Note:

  • The keyword supports copying the workbooks of file formats xlsx to xlsx and xls to xls only.

  • The workbook specified in FilePath1 (source) is copied to the workbook specified in FilePath2 (destination).

  • The copying of the workbooks can be changed based on the options provided below:

0 or empty (default): This option will append the unique workbook sheets to the destination workbook and replace the workbook sheets with common names.

For example,

WorkBook1: consists of Sheet1, Sheet2 and Custom_Sheet3.

WorkBook2: consists of Custom_Sheet1, Custom_Sheet2 and Custom_Sheet3.

After this option is used for the keyword, WorkBook2 will consist of Custom_Sheet1, Custom_Sheet2, Sheet1, Sheet2, and Custom_Sheet3 (overwritten from WorkBook1).

1: This option will append all sheets, irrespective of common names, by incrementing the sheet names.

For example,

WorkBook1 consists of Sheet1, Sheet2 and Custom_Sheet3.

WorkBook2 consists of Custom_Sheet1, Custom_Sheet2 and Custom_Sheet3.

After this option is used for the keyword, WorkBook2 will consist of Custom_Sheet1, Custom_Sheet2, Custom_Sheet3, Sheet1, Sheet2, and Custom_Sheet3 (1).

2: This option copies all the sheets in the source workbook and paste them into the destination workbook. It removes all the previously existing data from the destination workbook.

For example,

WorkBook1 consists of Sheet1 and Sheet2.

WorkBook2 consists of Custom_Sheet1, Custom_Sheet2 and Custom_Sheet3.

After this option is used for the keyword, WorkBook2 will consist of Sheet1 and Sheet2.

  • The copy method type (text/special) works as follows:

® The ‘text’ option only copies the data. This method is not dependent on the system where the ICE is running.

® The ‘special’ option copies all the data along with the formatting. This method depends on the system and will work only on the Windows OS installed on the Excel application.

® This argument is case insensitive.

® Its default value depends on the system's OS.

® If the ‘copyWorkBook’ keyword is run on a Windows OS with an Excel application and the user provides no value for this argument, then ‘special’ will be the default copy method type.

® If the ‘copyWorkBook’ keyword is run on any OS, NOT Windows, and the user provides no value for this argument, then ‘text’ will be the default copy method type.

Output: <Dynamic Variable> ;< Dynamic Variable> (Optional)

Use case/Example

Scenario: Copying a Workbook for Data Backup

When testing a Backup feature of an application, the action verifies that the application correctly copies a specified workbook to a designated location, preserving all the data and formatting. It especially helps with a financial application, where users regularly creating backups of workbooks are required to prevent data loss.

Input data:

  • C:\Users\pasarge.ganesh\Downloads\Userdetails.xlsx;Sheet

  • C:\Users\pasarge.ganesh\Downloads\Employeedetails.xlsx;Sheet 2

Expected result: The data from excel sheet 1 in the user details workbook will be copied to sheet 2 in the employee details workbook.

Output: The output variable {Result} contains status of execution as Pass, which can be utilized for further excel work.

Last updated

Logo