I have an excel file with dynamic rows volume, what I want to achieve that to keep only the first 50'000 rows of the file and delete the rest, so if the file has 325,000 then keep the first 50,000 and delete the other 275,000 rows.
Any idea how to do this? I know that this is a novice question, but I don't know how to start with that.
Import-Excel file1.xlsx -StartRow 1 -EndRow 50000 | Export-Excel file2.xlsx