"Automating Data Processing with Excel, , and File Handling in UiPath"

Hey Community, well I need help

I have two folders in a server; one contains an excel file and the other folder contains sub files named by code postal .

I have to build a process where I need:

  • to read the excel file (name, class, city) and filter it based on city name
    -then I have to go to another platform where I look which code postal suits the city I got after the filter
    -and after I go to the other folder that contains the sub files and choose the sub file named by the specific postal code that we found.

I’d like to ensure you that for the logging phase it’s ok but I need the help for the invoke codes of the sub processes (filter the excel file) (look up into the folder about the file that we want)

1 Like

Hi

Hope this helps in terms of activities that can be used

For this u can use

For this step u can do it with

The above link has got a tutorial of how to work with files and folders

Cheers @plumpyas

I got you but I need to build a logic I was thinking of building a data table where I store the cities we choose after the filter and add a column with code postals that suits each city so I can search into the code postal column and navigate into the folder containing the subfiles named by code postals and where I found a similar code postal I choose that file and I host it in a shared folder
and I need help to buils this process

Hi @plumpyas

Try this

  1. Read the Excel File:

  2. Filter the DataTable Based on City:

    • Use the Select method of the DataTable to filter the rows based on the city name obtained from a previous step. For example:
      filteredRows = dt.Select("City = 'YourCityName'")
      
    • filteredRows will contain the rows that match the specified city.
  3. Look Up Postal Code:

    • For each row in the filteredRows, you can use an HTTP Request or API call to look up the postal code for the city on the external platform.
  4. Navigate to the Folder and Choose Sub File:

    • Using the obtained postal code, construct the path to the subfolder within the other folder containing the subfiles.
    • Use the “Directory.GetFiles” method or activities like “For Each” and “Path Exists” to locate the specific subfile within the subfolder.

Here’s a sample Invoke Code activity for filtering the DataTable:

Dim filteredRows As DataRow() = dt.Select("City = 'YourCityName'")

If filteredRows.Length > 0 Then
    ' Process filteredRows (e.g., iterate through the rows)
    For Each row As DataRow In filteredRows
        ' Access row data (e.g., row("Name"), row("Class"))
    Next
Else
    ' Handle case when no matching rows were found
    ' You can log this as well
End If

Thanks!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.