Hi,
Two pivot tables are to be created from one Excel sheet. Within the Use Excel File Activity, the data must be formatted as a table in order to create a pivot table. The same data basis is needed for both pivot tables.
Case 1: Both pivot tables do not exist yet: The bot formats the data base into a table and creates the pivot tables. Everything is fine.
Case 2: One of the two pivot tables is missing, so the bot only needs to create one pivot table from the data base that has already been formatted as a table.
In order to use the data base that is already formatted as a table, I wanted to add an if-condition that checks if the data base is already formatted as a table. UiPath returns the error that a table cannot overlap another table if it is already formatted as a table. For this reason the if-condition should be inserted before it.
Can you refer to the below video? If you are creating the pivots in 2 different sheets or without overlapping to another, i think it will work fine with Create Pivot activity.
The pivot tables do not overlap, they are in two separate sheets.
The point is, if the bot crashes in the meantime and only one pivot table is created, then the bot should check if both pivot tables are present on the second run.
If one pivot table is missing, it should create it afterwards with the existing data.
To create a pivot table you have to use the Activity Format as a Table. But since the bot has already created a pivot table, the data base is already formatted as a table, which leads to the above mentioned error.
I solved the issue with try catch: Within the try section I set the Format as Table activity. In the catch section I set the Get table Range activity where the output variable is the Pivottablename variable which is also used in Format as Table activity.