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 / Setting up specific ex...
Power Automate
Unanswered

Setting up specific expression to remove comma inside strings but not comma outside string

(0) ShareShare
ReportReport
Posted on by 432

Hi,

 

I'm trying to come up with an expression that I can run over each line in a csv file.

example line in csv:

 

 

 

Bill Carpenter, "Fighter,Jet", 13.3, "HR, Manager", Apples

 

 

 

as we notice some items are provided with " "  (which obviously i can easily replace with replace by "") however as you can see the Fighter Jet and HR Manager contain a  ,  aswel.   Im not guaranteed each line in the csv has the same format (ie;  " " data is on the same place and wether a , is inside a string at all). 

but i want to strip  all   comma's  (,) inside string values ""   aswel as remove all "".  

Categories:
I have the same question (0)
  • Verified answer
    PrasadAthalye Profile Picture
    on at

    See if below helps... You can put it in a loop for each row in CSV file..

     

    Using split to put it in Collection

    split(string(variables('varData')), '"')
     
    and then replace commas,  This will replace all commas, but you can then run a loop on array to take further action
    replace(variables('TextAfterSplit'), ',''')
     
     
     

    FlowSplit.png

     

  • gjeh Profile Picture
    432 on at

    thanks, this helped me do exactly what i wanted!!

  • virakones Profile Picture
    389 on at

    hi @PrasadAthalye 

    Thank you for the suggestion - seems to be on the right path for my particular CSV problem, similar to @gjeh 

    I've tried splitting my CSV data along the double quotes (") and managed to isolate the values that have unwanted commas inside.

    As you mention, the final "ReplacedText" is my CSV file entirely missing commas - which I still need later.

    However, in the Apply to Each current item, it just seems like its every other item is the one I would like to replace the comma - example below where I would like to keep my CSV data intact (I still need commas) but only replace in every other "Value", and then finally bring everything back together as a regular CSV to parse later in the flow.

    Apply to Each 1/10 - CSV Data

    > Apply to Each 2/10 - Value,1 (Should be Value 1)

     > Apply to Each 3/10 - CSV Data

      > Apply to Each 2/10 - Value,2 (Should be Value 2)

    etc.

    Then finally I want to end up with CSV Data,Value 1,CSV Data,Value2, etc.

  • PrasadAthalye Profile Picture
    on at

    @virakones - Can you please open a new question for this? This already has a solution identified... We will work on the new thread to look at your case..

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