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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / apply replace function...
Power Automate
Unanswered

apply replace function only on certain elements

(0) ShareShare
ReportReport
Posted on by 81

Hello,

 

I created a flow to export power apps data to a CSV file.

My delimiter is ";" so I replaced all the "," in my JSON content with ";".

replace function:

@{replace(body('Create_CSV_table'),',',';')}

 

Everything works but the numbers therefore take this form: 1002;98 instead of 1002,98.

Which makes sense but I would like to know if I can apply my replace function to all content except numbers.

 

Can someone help me ?

Thanks in advance ! 😀

Categories:
I have the same question (0)
  • grantjenkins Profile Picture
    11,063 Moderator on at

    You can have a look at my solution using Office Scripts in the link below. You might need to take the body of the CSV data and convert semi-colons to commas prior to passing into the Run script action. Let me know if you try this and have any issues, etc.

     

    Solved: Re: Parsing a CSV that contains embedded commas - Power Platform Community (microsoft.com)


    ----------------------------------------------------------------------
    If I've answered your question, please mark the post as Solved.
    If you like my response, please consider giving it a Thumbs Up.

  • TauGI Profile Picture
    81 on at

    Thank you for your answer but I don't want to use the office script. This flow power automaton will be used by many users and the goal is to automate without going through more clicks...

     

    chat gpt offers me this that I don't quite understand:

     

    To replace commas with semicolons for all elements of a CSV table except for one, you can use the "For each" action in Power Automate to loop through each row in the table, and then use the "Replace" expression to replace commas with semicolons.
    
    Here are the steps to follow:
    
    Add a "For each" action and select the CSV table you want to modify.
    
    In the "For each" action, add an "Initialize variable" step to store the data for each row.
    
    In the "For each" action, add a "Modify variable" step to replace commas with semicolons, except for the item you want to keep using a condition.
    
    In the "For each" action, add an "Add row to a table" step to add the modified row to a new table.
    
    Here's an example expression for replacing commas with semicolons using the Replace function:
    
    replace(item(), ',', ';')
    
    If you want to keep a specific item in the row as-is, you can add a "Condition" to check if the item is present in the row, and only replace it if it does not match that item.
    
    For example, if you want to keep the item in the first column and replace the others, you can add the following condition:
    
    if(not(contains(item(),'value to keep')), replace(item(), ',', ';'), item())
    
    This will replace commas with semicolons for all items in the row except for the one that contains "value to keep".

     

     

     

  • grantjenkins Profile Picture
    11,063 Moderator on at

    I’ll see what I can come up with a bit later - give me a day to try and get a solution for you 🙂

  • TauGI Profile Picture
    81 on at

    thank you very much ! 

    I remain at your disposal if you want the full flow.

  • grantjenkins Profile Picture
    11,063 Moderator on at

    Just looking at this again - what do you mean by your CSV is semi-colon delimited? When you export the CSV from your PowerApp does it come into your flow delimited by semicolon or comma?

     

    Just not sure what the requirement is to change from comma to semicolon.

  • TauGI Profile Picture
    81 on at

    I have to pass in semicolon otherwise the data is all displayed in the same column.

  • grantjenkins Profile Picture
    11,063 Moderator on at

    Are you able to provide a sample of the raw data you get (just a couple of rows would be fine).

     

    Also, your comment around using Office Scripts. My solution here was for it to be completely automated (so no extra clicks). The only caveat is that the Office Script would be stored in your OneDrive and you would have to share it with the users that needed to use it.

  • TauGI Profile Picture
    81 on at

    Here is an example:

    TauGI_0-1677593603280.png

    Everything works but the "," of the numbers are transformed into ";"

  • TauGI Profile Picture
    81 on at

    here is my flow power automaton to allow someone to help me:

     

    TauGI_0-1677839348552.png

     


    I've been looking for a solution for weeks...
    I have to replace the commas with semicolons but it also replaces the amount.

  • grantjenkins Profile Picture
    11,063 Moderator on at

    I'm hoping I've got something workable for you. Just off to sleep now but will try to get something for you in the next 24 hours.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard