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

Community site session details

Session Id :
Power Automate - Building Flows
Answered

remove last character from csv file

(0) ShareShare
ReportReport
Posted on by 11

Hello,

 

My CSV file has a unwanted comma at the end of each row which creates additional column in my subsequent process

 

Here is the sample data

 

Heading 1, Heading 2, Heading 3

1,2,3,

4,5,6,

7,8,9,

 

As you can see in the above example, I have 3 rows with one header. My value rows have comma at the end of each row which need to be trimmed. I tried but couldn't find a better way.

 

I tried the data operations in MS flow but couldn't get it all done 

I have the same question (0)
  • tom_riha Profile Picture
    10,179 Most Valuable Professional on at
    Re: remove last character from csv file

    Hello @KarthikKumarstp ,

    since it's a csv, I guess you're using split(...) by the end of the line character to split it into separate rows. Why don't you just add the comma to the split(...), instead of just the end of a line you can split it by comma and the end of the line (and then somehow remove the header).

  • Verified answer
    KarthikKumarstp Profile Picture
    11 on at
    Re: remove last character from csv file

    Thanks for the response.. I finally accomplished this by simple replace function.

     

    Here is what I did

     

    1. Initialized two variables - one with comma and hard return and another with just hard return
    2. Using replace function replaced variable 1 with variable 2

    KarthikKumarstp_0-1634565439367.png

    replace(outputs('CSVtoString'),variables('var_newlinew_comma'),variables('var_newline'))

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 614 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 401 Moderator

#3
chiaraalina Profile Picture

chiaraalina 282

Last 30 days Overall leaderboard