Hi,
i have one excel i want to delete last row of pivot table without opening excel.

above attached my screen shot for you.
Regards,
Mohamed Farhan
Hi,
i have one excel i want to delete last row of pivot table without opening excel.

above attached my screen shot for you.
Regards,
Mohamed Farhan
Hi @MD_Farhan1
You can use the below syntax
(Excel.Sheet("Sheet1").DataTableValue.RowCount).ToString
Regards
Hi @MD_Farhan1
You can use the Excel activites to delete the last row in pivot tables.
→ Use the Excel Process scope activity and insert the Use excel file activity inside of it.
→ Inside Use excel file activity insert the Find first\last row activity, In the source field type the Excel. it will shows the pivot tables in that excel. select that pivot table.
Check the below one,
Excel.Sheet("Sheet name").PivotTable("Pivot Table Name")
→ Create a variable in the Save last row number as field to store the last row number in a variable.
→ Then use the delete row activity to delete the last row in Pivot table.
Open the Properties of Excel Process scope activity go to properties and select the false option for Show excel window property. It will not open the Excel in foreground.

Hope it helps!!
not working bro… any linq method to delete last row??
Yeah sure bro please give me 2mins
Regards
Use Excel File : Provide path to your Excel file
-Read Range: Read pivot table data into a DataTable dtPivotTable.
-Assign: dtPivotTable to dtPivotTable.Rows.RemoveAt(dtPivotTable.Rows.Count - 1)
-Write Range: Write dtPivotTable back to the Excel file, overwriting the pivot table data.
HAPPY AUTOMATION!!
Hi @MD_Farhan1
Please check the below screenshot and vba code:
DeleteGrandTotalRow.txt (542 Bytes)
Regards
Thank you Bro now its working fine ![]()
You’re welcome bro @MD_Farhan1
Happy Automation!!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.