Share via


How to remove Column and row on excel file

Question

Thursday, June 11, 2020 9:30 AM

Hi guys.
I have used the script below to remove column (first 4 Columns) and row (first 13 rows) and it has worked.
However, now I am testing the same script in a new excel file with a button (image) and it is no longer working.
Is there a way to force the removal, even if there is a button, macro or other things inside a file?
Can you help me please?

**This is the script **

$ExcelPackage = Open-ExcelPackage -Path C:\Local\test.xlsx
$ExcelPackage.Workbook.Worksheets[1].DeleteRow(1,13)
$ExcelPackage.Workbook.Worksheets[1].DeleteColumn(1,4)

All replies (2)

Thursday, June 11, 2020 7:58 PM

To remove objects you will have to locate them in the objects collection and remove them.  Removing rows will just reposition the objects.

\(ツ)_/


Friday, July 3, 2020 3:35 AM

Hi,
Was your issue resolved? 
If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.
If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.
If no, please reply and tell us the current situation in order to provide further help.
Best Regards,
Yang Yang

Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact [email protected].