Skip to content

Get Column Sum in Excel Handler: getColumnSumExcel

This function calculates the sum of all numerical values in a specified column of an Excel sheet. The sum is stored in a variable that can be used in further automation steps.

Note: Ensure that the file being used is not open during the execution of the Case to avoid errors or conflicts.

Example: Suppose you have an Excel file named SalesData.xlsx located at C:\Data\, and you want to calculate the total sales amount present in Column “C” (Sales Amount) of the “January” sheet.

Steps to Configure:

  1. Add a new step.
  2. Select Set a Variable Value from the Action dropdown.
  3. Enter a variable name in Element Key (e.g., TotalSales). This variable will store the calculated sum.
  4. Click Form, select Functions, and choose Get Column Sum in Excel Handler.
  5. Provide the required parameters:
    • FPath: The full path of the Excel file from which the column sum needs to be retrieved (e.g., C:\Data\SalesData.xlsx).
    • CellAlphabet: The alphabet of the column whose values need to be summed (e.g., C for column C).
    • Sheet: The sheet can be identified either by its name (e.g., SalesReport) or by its sheet index number (e.g., 1 for the first sheet).
    • ColumnName: The header name of the column whose values need to be summed (e.g., Total Sales).
  6. Click Save.

Note: While the steps for adding an Action are identical in both views, the display of the steps changes:

scrn-get-column-sum-card-view
Tabular View
scrn-get-column-sum-tabular-view
Card View

Outcome on Execution:

  • The function calculates the sum of all numeric values in the specified column of the given Excel sheet. The result is stored in a variable defined in Element Key.
  • This sum can be used in automation workflows using the variable syntax ${ColumnSum}.

Back To Top