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 / remove last character ...
Power Automate
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 

Categories:
  • tom_riha Profile Picture
    10,187 Most Valuable Professional on at

    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

    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 317 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 247

#3
Henil Profile Picture

Henil 117

Last 30 days Overall leaderboard