cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
egornua1
Helper V
Helper V

HTTP delete worksheet

Hello All,

 

Hope someone can help.

I am trying to delete a worksheet from an excel file on sharepoint and getting and error with the URI.

Error

{"odata.error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"The expression \"web/lists/GetByTitle('SC Customer Shipping Schedules')/items/%2fSC+Customer+Shipping+Schedules%NameofCustomer_Shipping+Schedule_22_52_2022+8_52+AM.xlsx/workbook/worksheets/Sheet1\" is not valid."}}}

 

Thank you

DeleteJPG.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @egornua1,

 

Is this a one time thing? In my earlier shared example I used the Graph Explorer to figure out those specific ids for my sample site, document library and Excel document.

https://developer.microsoft.com/en-us/graph/graph-explorer

 

Search for your site and return id and weburl

 

https://graph.microsoft.com/v1.0/sites?$search=PowerUsers&$select=id,webUrl

 

 

List drives and return name and id (this uri uses the siteid returned in the first list sites query)

 

https://graph.microsoft.com/v1.0/sites/@{variables('SiteId')}/drives?$select=name,id

 

 

List children of Drive and return name and id (this uri uses the siteid returned in the first list sites query and the driveid returned in the second query)

 

https://graph.microsoft.com/v1.0/sites/@{variables('SiteId')}/drives/@{variables('DriveId')}/root/children?$select=name,id

 

 

You can also use those URIs in three different Send an HTTP request actions (Office 365 Groups connector) if you need to dynamically retrieve those ids. But in that case you probably need to apply some filtering logic as well in your setup.



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


View solution in original post

4 REPLIES 4
Expiscornovus
Super User
Super User

Hi @egornua1,

 

That is a Graph API method, not a REST API v1 method.

https://learn.microsoft.com/en-us/graph/api/worksheet-delete?view=graph-rest-1.0&tabs=http

 

I would suggest to try it in a Send an HTTP request action (of the Office 365 Groups connector).

 

Try something like below.

https://graph.microsoft.com/v1.0/sites/@{variables('SiteId')}/drives/@{variables('DriveId')}/items/@{variables('DriveItemId')}/workbook/worksheets/@{variables('SheetName')}

 

deleteworksheet.png

 

response204.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


@Expiscornovus  - thank you for the direction on this as is new to me.

Could you tell me how to get the  variables - siteid | DriveId | DriveItemId?

file resides in sharepoint doc library.

 

Thank you.

Expiscornovus
Super User
Super User

Hi @egornua1,

 

Is this a one time thing? In my earlier shared example I used the Graph Explorer to figure out those specific ids for my sample site, document library and Excel document.

https://developer.microsoft.com/en-us/graph/graph-explorer

 

Search for your site and return id and weburl

 

https://graph.microsoft.com/v1.0/sites?$search=PowerUsers&$select=id,webUrl

 

 

List drives and return name and id (this uri uses the siteid returned in the first list sites query)

 

https://graph.microsoft.com/v1.0/sites/@{variables('SiteId')}/drives?$select=name,id

 

 

List children of Drive and return name and id (this uri uses the siteid returned in the first list sites query and the driveid returned in the second query)

 

https://graph.microsoft.com/v1.0/sites/@{variables('SiteId')}/drives/@{variables('DriveId')}/root/children?$select=name,id

 

 

You can also use those URIs in three different Send an HTTP request actions (Office 365 Groups connector) if you need to dynamically retrieve those ids. But in that case you probably need to apply some filtering logic as well in your setup.



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


egornua1
Helper V
Helper V

@Expiscornovus - Thank you for the help on this.

I managed to get it working for my requirement.

One thing, i was using the version 2 HTTP action and that didn't work so reverted to the previous version and its working fine. Thanks Again.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (3,418)