cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KCarlton96
Frequent Visitor

Issues deleting sheets from excel workbook using office script

I am using @DamoBird365's tutorial on how to separate an excel workbook into multiple files.

The initial file is a macro enabled worksheet stored in sharepoint.

 

When trying to run the delete script I am running into the following error: 

"We were unable to run the script. Please try again.\nRuntime error: Line 8: Cannot read property 'delete' of undefined
 
Due to the file being macro enables I had to add in a condition to remove certain sheets from the worksheet listing. Please see screen shots included:
excel sheets flow 1.pngexcel sheets flow 2.pngexcel sheets flow 3.png
Any advice or assistance would be highly appreciated.
1 ACCEPTED SOLUTION

Accepted Solutions

@KCarlton96 

 

You’ve got extra [] around your array for sheets to delete. Check how you’ve built that.

 

damien

View solution in original post

6 REPLIES 6
DamoBird365
Super User
Super User

Hi @KCarlton96 

 

Might just be that you need to use Id rather than identifier for the office script (Delete Sheets via Script) file parameter.

 

Damien

Hi @DamoBird365 ,

Thanks for your response. That produced the same error I mentioned above, so I'm still stuck unfortunately.

Hi @KCarlton96 

 

Can you share a screenshot? And copy the output for the failing action.

 

Damien

Hello @DamoBird365 ,

 

Sure. See below:

excel sheets flow 4.pngexcel sheets flow 5.png

@KCarlton96 

 

You’ve got extra [] around your array for sheets to delete. Check how you’ve built that.

 

damien

Hi @DamoBird365,

 

Thank you so much. Power Automate put it in when I added the body of the filter array to that field.

 

Hope you and yours are safe and well

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (1,553)