cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
taate29
Regular Visitor

Renaming an excel worksheet using power automate

Hey guys!

 

I have a flow already running: It's function is to save an attachment from an email (a .xlsx file) in a sharepoint folder. But this files has different worksheet names, and I need that all the worksheet names to be the same. Any ideas of how can I build this part of the flow?

 

Thank you in advance,

1 ACCEPTED SOLUTION

Accepted Solutions
ScottShearer
Super User III
Super User III

@taate29 

As there is no action to rename worksheets, I don't believe that you'll be able accomplish this with Power Automate.

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

3 REPLIES 3
ScottShearer
Super User III
Super User III

@taate29 

As there is no action to rename worksheets, I don't believe that you'll be able accomplish this with Power Automate.

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

Hi Scott!

 

That's sad... I'll try to find another option.

 

Thank you!

bBI
Regular Visitor

I'm trying a solution with Power Automate (which has a connectors for running Excel Scripts)

Did a small test for renaming a worksheet and it recorded the action as such:

function main(workbook: ExcelScript.Workbook) {
let name_of_worksheet = workbook.getWorksheet("name_of_sheet");
// Rename worksheet to "new_name_of_sheet"
lVDR.setName("new_name_of_sheet");
}

Script records hardcoded it seems. Not sure how to make the thing dynamic.

 

Is there a way to encode the equivalent of "look, dude, just rename the first worksheet, regardless of what it's originally named"?

 

 

Edit: so according to this page you can refer to worksheets by name or by index (leftmost sheet having index 1)

 

However when I change in the script above name_of_sheet into workbook.getWorksheet(1) the following error is generated


[2, 36] Argument of type '1' is not assignable to parameter of type 'string'.

Anyone have any ideas what is needed? Do I need to wrap it in single quotes? Double quotes? Throw extra stuff in between those brackets?

Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (49,428)