How to delete the last line in an Excel file

Hello,
how can I delete the last containing data in an Excel file in StudioX? The length of the file varies and also the content in this last line can vary. How can the robot select only the last line in the file and delete it?
Thank you,
Tom

Hi @tom.abrahams

Int32 index = dt.Rows.Count

This will give you the Index of Last Row in that particular Excel

Then Use the Insert/Delete Row Activity as shown below :-
image

Note :- In place of position within Properties pass the index variable

Mark as solution and like it if this helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Hi Pratik,

Thank you for your explanation.

Being a rooky, can you please send me print screen of how Int32 index = dt.Rows.Count should be applied?

I tried using it in the Variable field but without success.

Thanks!

Tom

Hi @tom.abrahams

Below is the workflow for the same :-
MainPratik.xaml (7.4 KB)

Output :-
image

Mark as solution and like it :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

1 Like

Works perfect!
Thanks!

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