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 Automate
Answered

soved

(0) ShareShare
ReportReport
Posted on by 125
I have the same question (0)
  • mdevaney Profile Picture
    29,991 Moderator on at

    @dheeraj867 
    Suggest you try to do it without Javascript.

  • dheeraj867 Profile Picture
    125 on at

    i want to do this with java script only

  • VJR Profile Picture
    7,635 on at

    Hi @dheeraj867 

     

    As stated earlier javascript is more for integration with web.

     

    I have written a vbscript here to access an Excel file if you would like to take a look.

     

    https://powerusers.microsoft.com/t5/Power-Automate-Desktop/Excel-How-to-convert-range-of-numbers-to-percentages-of-rounded/m-p/1481133/highlight/true#M11894

     

  • dheeraj867 Profile Picture
    125 on at

    please share proper code for vb script for that ...that i can easy to understand

  • VJR Profile Picture
    7,635 on at

    Hi @dheeraj867 

     

    The code is the simplest of all. Create an Excel object, open an excel file and start interacting with the sheet and cells you want.

    Which is the line of code that you did not understand?

    Also did you paste the code in your editor and try to work it out?

  • dheeraj867 Profile Picture
    125 on at

    Power Automate 02-03-2022 15_57_49.png

    see i have try this java script but i cant able to increment variable in i its just doing single value 4 times in loop 

  • Henrik_M Profile Picture
    2,021 Super User 2024 Season 1 on at

    That's because anything between % signs is evaluated BEFORE the script is compiled.

  • VJR Profile Picture
    7,635 on at

    This approach is only because you wanted to do using javascript. Else it is also possible directly in PAD 😊.

     

    VJR_1-1646221597960.png

     

    Reading the value in loop, removing first 3 characters in javascript, returning the output and writing to Excel.

    VJR_2-1646221723284.png

     

     

    Input/Output:

     

    VJR_0-1646221538501.png

     

     

    Copy-Paste the below code in your flow editor, change the excel path and run the process

     

    Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: $'''c:\\test\\Excel.xlsx''' Visible: True ReadOnly: False Instance=> ExcelInstance
    Excel.ReadFromExcel.ReadAllCells Instance: ExcelInstance ReadAsText: False FirstLineIsHeader: True RangeValue=> ExcelData
    Excel.GetFirstFreeColumnRow Instance: ExcelInstance FirstFreeColumn=> FirstFreeColumn FirstFreeRow=> FirstFreeRow
    LOOP WHILE (LoopIndex) < (FirstFreeRow)
     Excel.ReadFromExcel.ReadCell Instance: ExcelInstance StartColumn: $'''A''' StartRow: LoopIndex ReadAsText: False CellValue=> ValueRead
     Scripting.RunJavascript JavascriptCode: $'''var str=\"\";
    str = \"%ValueRead%\";
    str = str.substring(3);
    WScript.Echo(str);''' ScriptOutput=> JavascriptOutput ScriptError=> ScriptError
     Excel.WriteToExcel.WriteCell Instance: ExcelInstance Value: JavascriptOutput Column: $'''A''' Row: LoopIndex
     Variables.IncreaseVariable Value: LoopIndex IncrementValue: 1 IncreasedValue=> LoopIndex
    END

     

    You also have a same post here.

    Can you please close the posts. 

     

     

  • dheeraj867 Profile Picture
    125 on at

    u have done really great can we do that while loop in java script for the same it will take less time? 

  • dheeraj867 Profile Picture
    125 on at

    can u give the solution for that for better understanding

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 272 Super User 2026 Season 2

#2
trice602 Profile Picture

trice602 147 Super User 2026 Season 2

#3
11manish Profile Picture

11manish 146 Super User 2026 Season 2

Last 30 days Overall leaderboard