Read Workbook

This activity helps the user to read the data from the all the sheets available in the
provided input excel workbook.
This activity works within the Excel scope activity.

Technical Reference

INPUT

IncludeColumnHeaders: Indicates to include the “Column Headers” in the excel sheet when reading the data from the sheets in the provided input excel workbook.

If left blank, the column headers will not be considered.

 

 

 

 

 

 

MISC

DisplayName: Displays the name of the activity. The activity name can be customized, which aids in troubleshooting.

SkipOnError: Specify the "Boolean" value as "True" or "False."

 

True: Continue executing the workflow regardless of any errors thrown.

False: Halt the workflow if it encounters any errors.

None: If the option is left blank, the activity will, by default, behave as if "False" were chosen.

Version: It indicates the version of the feature being used.

 

 

OUTPUT

Dataset: It helps to view the output of the activity as extracted data from all the sheets in the workbook in “Dataset” value.

It returns the values in “Dataset” datatype. Refer the below example to view how to declare the variable.

Result: It provides the ability to view the execution status of the activity. It returns values in "Boolean."

 

True: Indicates that the activity has been executed successfully without any errors.

False: Indicates that the activity has been unsuccessful due to an unexpected error being thrown.

SheetNames: It helps to view the output of the activity as the extracted “List” of sheets available in the provided input excel workbook. It returns the values in the “list of string” datatype. Refer the below example to view how to declare the variable.

Represents mandatory fields to execute the workflow

  

Here’s an example of how “ReadWorkbook” activity works –

In the following example, I am using the “Excel sheet” which is used to automate in
the Use case. To get a better understanding, click here.

This report encompasses employee particulars like Name, Position, Age, Office,
Start date, and Salary.

1.       Here, I am continuing from the “CreateWorksheet” activity’s example.

2.       Now, placing the " ReadWorkbook " activity within the scope activity.

a.       In this case, I am reading all the sheet names and extracting the data in the
dataset value using this activity.

b.       Navigating to the “IncludeColumnHeaders” in the properties to include the
column headers also.

i.      Here, I am extracting the data from all the sheets, hence I am including the
column headers also.

c.       Moving to the “Dataset” in the output of the properties to declare a variable to
store the data from all the sheets.

i.      There are two ways to create a variable-

ii.      Method 1 – Click on the "Dataset" property within the "ReadWorkbook" activity
and enter the variable name. In this case, we are using “SheetData." Then,
press "Ctrl+Q," which is a shortcut key to create a variable.

iii.      Method 2 - Click on the Variables pane and enter the name " SheetData."
Then, in the "Variable Types" column, select "Browse for Types" from the
dropdown menu.

iv.      The .Net window for data types will appear on the screen, enter the type
name as “System.Data.Dataset” and then click on “OK” button.

d.       Now, moving to the “SheetNames” in the output properties to declare a
variable to view the list of sheets available in the excel workbook.

i.      There are two ways to create a variable-

ii.      Method 1 – Click on the "SheetNames" property within the "ReadWorkbook"
activity and enter the variable name. In this case, we are using “SheetList."
Then, press "Ctrl+Q," which is a shortcut key to create a variable.

iii.      Method 2 - Click on the Variables pane and enter the name " SheetList."
Then, in the "Variable Types" column, select "Browse for Types" from the
dropdown menu.

iv.      The .Net window for data types will appear on the screen, enter the type
name as “System.Collections.Generic.List.String” and then click on “OK”
button.

3.       Now, add a “Writeline” activity to view the list of sheet names.

a.       Enter the “Input” text as
“SheetList(0).ToString + SheetList(1).ToString + SheetList(2).ToString”.

i.      Here I am writing all the sheet names in the output window.

ii.      The “.ToString” is advised to use along with any other data types other
than string format. It converts any data type into string.  

4.       You can add the “DatasetViewer” activity to view the dataset values. Click
here to know.

5.       Now, execute the workflow.

Below is a sample of the output of the activity.

In DataSetViewer:

In WriteLine: