Hello, I’m new to UiPath, I’m practising “create pivot table”, and wondering if I can sort the “value” column as we usually do in Excel. I tried “sort range” several times, but failed. not sure whether “sort range” is the correct way to do the simply sorting for pivot table.
As there is no official activity, You can use VBA code for sorting pivot table.
Hey @CHEN_YIJIAN
Could you please show the screenshot and highlight on what you are trying to sort here ?
Thanks
#nK
Hi
Welcome to uipath forum
I think there is no direct activity to sort pivot table in excel in studioX
You can try with vb script here with invoke code activity
This example sorts the Company field in descending order, based on the sum of sales.
ActiveSheet.PivotTables(1).PivotField("Company") _
.AutoSort xlDescending, "Sum of Sales"
Cheers @CHEN_YIJIAN
thanks for your reply, may I know how to use “invoke code activity”?
Hey @CHEN_YIJIAN
This should help - Sort Table
If that’s not let us know, what’s the challenge/issue you are facing.
Thanks
#nK
thanks for your feedback, example in this link can not be opened, coz I’m StudioX user not Studio user. Also according to other people’s advice under this question, I would resort to VBA to see if it works.
thanks for reply. it seems no such activity in StudioX.
Main.xlsx (6.9 KB)
attached the main.xlsx for reference.
Fine
Go to activity panel and right click that filter symbol
Enable SHOW DEVELOPER and then try searching for that activity
Cheers @CHEN_YIJIAN
@CHEN_YIJIAN Can you share the sample excel file with PIVOT table that you created
@CHEN_YIJIAN You can read the PIVOT table to a data table from where you can sort using Sort data table activity (Ascending or Descending)
Please find the attached sample workflow based on Ascending sorting
Example.zip (25.5 KB)
after enabled “Show Developer”, it has only “Invoke Method” rather than “Invoke Code”, FYI.
thanks for this new thought. unfortunately the attachement can’t be opened due to the incompatibility…anyway i will try to figure it out by using this method. thank you!
I tried to switch to Studio, but failed. export log attached, could you pls help verify whether the pkgs are available? thanks.
output.txt (3.2 KB)
@CHEN_YIJIAN Can you please go to your package manager and check the latest version of excel, system and UIautomation activities. So that I can degrade the packages to that version and can send you updated code
@CHEN_YIJIAN Try with the attached one
Example.zip (51.2 KB)