# Copy Excel Workbook

This is a pre-built Action located under the **@Excel Element**. The functionality of this Action in Avo Assure is to copy the content from one Excel file to another. The result of this operation is stored in a dynamic variable for further use during test execution.

## Syntax

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

| Argument                             | Description                                                                                                                                                                                                                                                                         |
| ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>\<FilePath1><br>(Required)</p>    | Provide the path of the source Excel workbook (first Excel file).                                                                                                                                                                                                                   |
| <p>\<FilePath2><br>(Required)</p>    | Provide the path of the destination Excel workbook (second Excel file).                                                                                                                                                                                                             |
| \<Option>                            | <p>Option (Optional)<br>Defines the sheet copy behavior.</p><ul><li><strong>0</strong> or <strong>empty:</strong> Appends unique sheets and overwrites common sheets.</li></ul><p>For more information on how to use the Option parameter, refer to the note section below.</p>     |
| <p>\<text/special><br>(Optional)</p> | <p><strong>Copy method</strong></p><ul><li><strong>text</strong>: copies only data</li><li><strong>special</strong>: copies data with formatting (Windows OS only).</li></ul><p>For more information on how to use the text/special parameter, refer to the note section below.</p> |

{% hint style="info" %}
**Note:**&#x20;

* **Option (Optional)**\
  Defines how the sheets are copied from the source Excel file to the destination Excel file.\
  When performing a sheet copy between two Excel files, the **Option** parameter controls how the sheets are copied:
  * If the value is set to **0** or left **blank**, the action performs the following:
    * **Appends unique sheets** \
      Sheets that exist only in the source file are added to the destination file.
    * **Overwrites common sheets** \
      If both files have a sheet with the same name, the sheet in the destination file is replaced by the one from the source file.
* **Text/Special (Optional)**\
  Specifies how the data is copied between two Excel files.

  When you copy sheets between two Excel files, you can choose how the data is copied using the **Text/Special** parameter:

  * If the value is set to **text**, only the cell data (values) will be copied no colors, fonts, or formatting.
  * If the value is set to **special**, both the cell data and formatting (such as bold text, colors, borders, etc.) will be copied.
  * The **special** option works only on **Windows OS.**
    {% endhint %}

**Output Value**: `<Dynamic Variable>(Optional);<Dynamic Variable>(Optional)`

| Argument                                                    | Argument                                                          |
| ----------------------------------------------------------- | ----------------------------------------------------------------- |
| \<Dynamic Variable>(Optional);\<Dynamic Variable>(Optional) | Both dynamic variable stores the status as **True** or **False**. |

### Example: Copying Data from One Excel Workbook to Another

In this example, we explain how to copy content from one Excel workbook to another using the **Copy Excel Workbook** action.

* **Action**: Copy Excel Workbook
* **Input Value**: C:\Test\Source.xlsx;C:\Test\Destination.xlsx
  * The input value (**C:\Test\Source.xlsx;C:\Test\Destination.xlsx**) specifies the source and destination Excel file paths. The action copies all the content from the source workbook (Source.xlsx) to the destination workbook (Destination.xlsx).
* **Output Value**: {Status}
  * The execution status of the action is stored in this **{Status}** variable with the following possible values:
    * **True**: If the workbook is copied successfully.
    * **False**: If the workbook is not copied successfully.
* **Logical Explanation:** The **Copy Excel Workbook** action reads the value from the **Input Value** column **C:\Test\Source.xlsx;C:\Test\Destination.xlsx** and performs a copy operation from the specified source file to the destination file. After execution, the result of this operation is stored in the **{Status}** variable as true.

<figure><img src="/files/XoAv6UqGseapPGHjyk2w" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.avoautomation.com/avo-assure/actions/excel/copy-excel-workbook.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
