web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Get Excel sheet name a...
Power Automate
Answered

Get Excel sheet name and set part of the name to activate another sheet in a different excel workbook

(0) ShareShare
ReportReport
Posted on by 25

hi community

 

I used "Get active Excel worksheet" to get a "SheetName" variable & "SheetIndex"variable.

i.e. Excel with 3 sheets: "AUHeadcount", "Instruction", "detail"

 

Now i want to set a new variable "CountryName" using first 2 character of the Sheet name of the first sheet (Index 1), then use the new variable "Country Name" to locate a sheet in a different excel. 

i.e. Use "AU" to locate the sheet AU in a global headcount excel with multiple sheets like "AU", "NZ", "TH", "US"

 

Below is not working. I just don't know the code/language to use to get the first two characters of the content of a variable, and set as a new variable. I am pretty new so appreciate your direction. 

 

VIncent_AZK_0-1717940524397.png

 

I have the same question (0)
  • Verified answer
    eetuRobo Profile Picture
    4,579 Super User 2026 Season 1 on at

    Use Get subtext under Text actions:

    eetuRobo_0-1717944548652.png

    start character position to be 0 (first letter is 0 index) and number of characters 2

    eetuRobo_1-1717944685088.png


    Or other way could be to use Set variable and just use the first and second characters from the SheetName variable. When variable is string you can get single character of the strings value by adding square brackets at the end and inside that the positon of the character. So first character is %VariableName[0]% second would be %VariableName[1]%

    eetuRobo_2-1717944724459.png


    And if you would have Power Fx enabled the syntax would be:
    =Left(SheetName, 2)

    eetuRobo_3-1717945003219.png

    eetuRobo_4-1717945010621.png

     

  • VIncent_AZK Profile Picture
    25 on at

    thank you!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 246 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 176

#3
Haque Profile Picture

Haque 157

Last 30 days Overall leaderboard