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 Automate
Answered

searching in csv file

(0) ShareShare
ReportReport
Posted on by 6

Hi, I have searched everywhere but have not found a suitable answer. The AI didn't help either, so I'm going to ask you guys.


My problem is that I want to search for the phrase "SP" in a rather large table. After searching for it in a column, I want the value of the row to be imported into a variable that uses information about the location of the cell to give me its value.

 

Screenshot 2024-03-01 100029.png

 

Everything works perfectly, but only when I manually enter the value I am looking for (34) -> then I get the value I am looking for (price0). When I try to automate the whole thing, I get an error. I was trying with subtext and also nothing 😞 Is there a way around this?

Screenshot 2024-03-01 101848.png

Thanks in advance for your advice!
Have a nice day

I have the same question (0)
  • Deenuji_Loganathan_ Profile Picture
    6,250 Super User 2025 Season 2 on at

    @GregPL 

     

    What does the CSV file look like? Could you please share a screenshot, if possible, after concealing any sensitive information?

     

  • GregPL Profile Picture
    6 on at

    Hi @Deenuji,
    it will not be easy to remove sensitive data, because the whole document is sensitive... 😉
    I did my best!

     

    Screenshot 2024-03-01 124404.png

    I know which column the data (thats why i have there Column6) is in, but the position in the row changes. Once the value can be searched higher and once lower.... Therefore, it is necessary to search for a phrase (to determine the row of data) and implement it in final variable -> Price0.

    Thx for your help!

  • Verified answer
    Deenuji_Loganathan_ Profile Picture
    6,250 Super User 2025 Season 2 on at

    @GregPL ,

    The error is being thrown because a string value is being passed as an index. I've made appropriate conversions in the code below. Please review it, and feel free to ask if you have any questions.

     

    Deenuji_0-1709307626568.png

    Code:

    File.ReadFromCSVFile.ReadCSVWithCustomSeparator CSVFile: $'''C:\\Users\\Downloads\\_20240.csv''' Encoding: File.CSVEncoding.UTF8 TrimFields: True FirstLineContainsColumnNames: True CustomColumnsSeparator: $''';''' CSVTable=> CSVTable
    Variables.FindOrReplaceInDataTable.FindItemInDataTableEverywhere DataTable: CSVTable AllMatches: True ValueToFind: $'''SP''' MatchCase: False MatchEntireCellContents: False DataTableMatches=> DataTableMatches
    SET mrRow0 TO DataTableMatches[0][0]
    Variables.RetrieveDataTableColumnIntoList DataTable: CSVTable ColumnNameOrIndex: $'''Column#4''' ColumnAsList=> ColumnAsList
    SET Price0 TO $'''%''%'''
    SET FetchRowAsNumber TO 0
    SET ColumnName TO $'''Column#3'''
    SET Bool_Valid_Column TO False
    LOOP FOREACH CurrentItem IN DataTableMatches
    SET FetchRow TO CurrentItem[0]
    Text.ToNumber Text: FetchRow Number=> FetchRowAsNumber
    IF Bool_Valid_Column = $'''True''' THEN
    Display.ShowMessageDialog.ShowMessage Title: $'''Price Details''' Message: CSVTable[FetchRowAsNumber][ColumnName] Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed
    END
    END

     

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

    If I've resolved your query, please consider accepting it as the solution and giving it a thumbs up to help others find answers faster.

     

     

     

     

  • GregPL Profile Picture
    6 on at

    Thanks for the hint! After a small modification it helped 😀

    Have a nice day mate!

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