# Excel Calculate Formula

Calculates all formulas in 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.

`excelCalculate --file(Excel) [--sheet(String)] `

## 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 |
---|---|---|---|---|

File | `file` |
`Required` |
`Excel` |
Variable that stores the Excel instance. |

Sheet | `sheet` |
`Optional` |
`Text` |
Name of the spreadsheet containing the formulas. If the `Sheet` parameter is not specified, the command calculates the formulas of every spreadsheet of the given file. |

## Example

The following example shows the **Open Excel File** command opening an Excel file and storing it in a `Excel`

variable. The **Excel Calculate Formula** command
calculates all formulas from "sheet1" on this file. Finishing, the **Close Excel** command saves and closes the Excel file.

```
defVar --name openExcelFile --type Excel
excelOpen --file "" --savechangesopenExcelFile=value
excelCalculate --file ${openExcelFile} --sheet sheet1
excelClose --file ${openExcelFile} --save
```

❕ **Important:** To run the sample script, you must create the excel file and add formulas to it, then, enter the file path in the **Open Excel File** (`excelopen`

)
command.

## Limitations

The command does not work as intended if an excel formula contains mathematical operators such as `+`

and `*`

. Use Office commands instead of Excel specific commands to handle
files that contain mathematical operators.