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 / Having issue reading E...
Power Automate
Answered

Having issue reading Excel file with comma

(0) ShareShare
ReportReport
Posted on by 17

Hi Guys ,

I am reading excel file with different format from Share Point and validating Date format. I am stuck on a data field containing a comma in my .csv file.  The comma is part of the data so cannot be replaced with another delimiter but as a result the columns are not split correctly.

Here is the Example:

 

IDPartNameValueMonthDate
E4ZZ_PC_Watmar318.07110/3/2023
D4ZE_PC_Watmar132.96210/3/2023
V5ZN_PC_Stone370.38310/3/2023
K1ZV_PC_Water(Prod,Dev,UAT)13.61410/5/2023
D1ZZ_PC_XVH58.41410/3/2023

 

 

ripalamin_0-1698264424405.png

 

Categories:
I have the same question (0)
  • JonDoesFlow Profile Picture
    1,304 on at

    Try this

     

    https://powerusers.microsoft.com/t5/Building-Flows/Setting-up-specific-expression-to-remove-comma-inside-strings/td-p/645893

     



    ---------------------------------------------------------------------------


    If I have helped you with an answer, please accept this post as a solution and thumbs up my reply. Thanks !

    Blog - JonDoesFlow
    Twitter - JonDoesFlow
    YouTube - JonDoesFlow

  • ripalamin Profile Picture
    17 on at

    ripalamin_0-1698334318021.png 

    When I try to use it ask me for connection Name and API Key. Does API Key is free? Any suggestion.

     

  • ripalamin Profile Picture
    17 on at

    I have tried your suggestion 

    This Flow replace comma from every where and I want comma later to split the column value. How Can i do that?

     

     

     

    ripalamin_1-1698335667105.png

     

    This flow you have suggest me it replace comma from everywhere but I need comma later to split the column value and get specific Date column data.

  • grantjenkins Profile Picture
    11,063 Moderator on at

    Can you add a Compose directly after your Get file content using the following expression and run the flow. Then show the output you get from your Compose. I'm fairly certain we can get what you're after without a third-party solution and without having to use a loop.

     

    base64ToString(outputs('Get_file_content')?['body']?['$content'])

     

    grantjenkins_0-1698382626553.png

     

    I just wanted to confirm that it looks like that below (with double quotes around the Part Names that contain commas).

    grantjenkins_1-1698382786372.png

  • ripalamin Profile Picture
    17 on at

    I have already use Compose Action (ArrayData) in my flow. The output is same as you have.

    ripalamin_0-1698416023059.png

     

    The problem is when I split data after this step, it split ZV_PC_Water(Prod,Dev) in 2 separate column bcoz of comma. I want only in one column. 

     

  • Verified answer
    grantjenkins Profile Picture
    11,063 Moderator on at

    This is how I'd write the flow to get what you're after. This assumes you only have a single column that could contain commas within the text (in your example, the PartName column).

     

    Below is the CSV data that I'm importing into my flow.

    grantjenkins_0-1698416462634.png

     

    See full flow below. I'll go into each of the actions.

    grantjenkins_1-1698416487454.png

     

    Get file content using path retrieves my CSV file.

    grantjenkins_2-1698416521861.png

     

    Compose converts the CSV data to text using the following expression.

    base64ToString(outputs('Get_file_content_using_path')?['body']?['$content'])

    grantjenkins_3-1698416577884.png

     

    Select splits the data by carriage return and new line, then skips the first row (headers). And within the Map, it replaces the commas within the text to ||. Note that it doesn't replace the comma delimiters.

    //From
    skip(split(outputs('Compose'), decodeUriComponent('%0D%0A')), 1)
    
    //Map
    if(contains(item(), '"'), concat(slice(item(), 0, indexOf(item(), '"')), replace(slice(item(), add(indexOf(item(), '"'), 1), lastIndexOf(item(), '"')), ',', '||'), slice(item(), add(lastIndexOf(item(), '"'), 1), length(item()))), item())

    grantjenkins_4-1698416768338.png

     

    Filter array uses the output from Select and removes any empty rows. You normally get an empty row at the end of your array when splitting the data. The expression used is below.

    item()

    grantjenkins_5-1698416925794.png

     

    Select Final uses the output from Filter array and the following expressions.

    //ID
    split(item(), ',')[0]
    
    //Part Name
    replace(split(item(), ',')[1], '||', ',')
    
    //Value
    split(item(), ',')[2]
    
    //Month
    split(item(), ',')[3]
    
    //Date
    split(item(), ',')[4]

    grantjenkins_6-1698417052489.png

     

    After running the flow, we should get the following output.

    grantjenkins_7-1698417134371.png

    [
     {
     "ID": "E4",
     "Part Name": "ZZ_PC_Watmar",
     "Value": "318.07",
     "Month": "1",
     "Date": "10/03/2023"
     },
     {
     "ID": "D4",
     "Part Name": "ZE_PC_Watmar",
     "Value": "132.96",
     "Month": "2",
     "Date": "10/03/2023"
     },
     {
     "ID": "V5",
     "Part Name": "ZN_PC_Stone",
     "Value": "370.38",
     "Month": "3",
     "Date": "10/03/2023"
     },
     {
     "ID": "K1",
     "Part Name": "ZV_PC_Water(Prod,Dev,UAT)",
     "Value": "13.61",
     "Month": "4",
     "Date": "10/05/2023"
     },
     {
     "ID": "D1",
     "Part Name": "ZZ_PC_XVH",
     "Value": "58.41",
     "Month": "4",
     "Date": "10/03/2023"
     }
    ]

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 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard