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 / vbScript output syntax?
Power Automate
Answered

vbScript output syntax?

(0) ShareShare
ReportReport
Posted on by 79

Hi,

I am running PAD for SAP using vbScript and had echo out 4 items into it's variable hereby %VBScriptOutput%

How do i write each item onto excel?
i tried %VBScriptOutput[1]% onto cell A1 but it only wrote 9, how do i write the entire 99047030 onto cell A1?

What is the syntax i should put?

Thanks

 

Zy_Sin_0-1712331847621.png

 

I have the same question (0)
  • Verified answer
    Deenuji_Loganathan_ Profile Picture
    6,250 Moderator on at

    @Zy_Sin 

    Please follow the below suggested approach.

    First use split function and split your text variable(vbscriptoutput) with newline and iterate with foreach and write into your excel.

    Deenuji_0-1712332500724.png

     

    Code:

     

    Excel.LaunchExcel.LaunchUnderExistingProcess Visible: True Instance=> ExcelInstance
    SET VBScriptOutput TO $'''99047030
    90019853
    0.00
    515.83'''
    Text.SplitText.Split Text: VBScriptOutput StandardDelimiter: Text.StandardDelimiter.NewLine DelimiterTimes: 1 Result=> TextList
    LOOP FOREACH CurrentItem IN TextList
     Excel.GetFirstFreeRowOnColumn Instance: ExcelInstance Column: $'''A''' FirstFreeRowOnColumn=> FirstFreeRowOnColumn
     Excel.WriteToExcel.WriteCell Instance: ExcelInstance Value: CurrentItem Column: $'''A''' Row: FirstFreeRowOnColumn
    END

     

     

    How to copy/paste above code into your power automate flow?

    Deenuji_1-1712332609893.gif

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

     
  • Zy_Sin Profile Picture
    79 on at

    Hi 
    it works

    can you help with this syntax

    i want it to do the following if the split text item 1 is not empty but it don't seem to work for what i wrote here

    if Not %TextList[1]% Then

    ....

    thanks

    Zy_Sin_0-1712337954110.png

     

  • eetuRobo Profile Picture
    4,478 Super User 2026 Season 1 on at

    I think the issue there is that your syntax is doing if without comparing it to anything. You would need to compare it to something. What are you trying to check in that if statement?

    So lets assume %TextList[1]% = 123. Your syntax is asking "If Not 123 then do something" but the syntax doesn't determine what should be 123. 
    Also I am not sure but it might be better to use <>
    So if you want to check if it is empty then:
    If %TextList[1]% <> "" Then

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 308

#2
David_MA Profile Picture

David_MA 256 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 226 Most Valuable Professional

Last 30 days Overall leaderboard