How to create pivot table at the end of the sheet

How to create pivot table at the end of the sheet.
How to create the pivot table dynamically at a end of the excel sheets simultanously

Hi @anjani_priya

You can use the Create Pivot Table activity to create the table.
In the destination property you can pass the cellname

For example if your sheet has 100 rows

and you want this pivot table to be created on 102 row.
image

Use Last row Property to get the count of rows, LastRowCount
LastRowCount= LastRowCount+3
(add 2 or 3 to it, to place your Pivot Table at correct place)

because you want it to leave one line after your data ends and give
Excel.Sheet(YourSheetName).Range(“A”+LastRowCount.ToString)

Thanks

Happy Automation!

Hi @anjani_priya

You can find the last data row & by using the create pivot table you can create the pivot table in the same sheet at the end of the excel sheet.

Hope this helps :slight_smile:


getting this error


iam getting this error

Add some delay, Is the excle file xls or xlsx?

Excel - How to deal with Exception from HRESULT: 0x800A03EC - News / Tutorials - UiPath Community Forum

how to keep if condition like
current sheet a2 cell is empty?
because some of my sheets are empty having headers only

You can add condition like this if data is there then only it will create the pivot table

Hi @anjani_priya

use the below macros and please make sure to change the sheet names and the fields as per your requirement.
PivotTable.txt (1.2 KB)

Regards

the pivots are not created

if data is there then only it will create. share your excel file

sheet1 - Copy.xlsx (1.2 MB)

Hi @anjani_priya

Please check the below:

PivotTable.txt (1.2 KB)

Regards

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.