new-UDGrid's: How to display list of csv files in foreach loop?

I am pulling a list of all .csv files in a folder, and trying to use a foreach loop to display each .csv file in a separate row in a UDGrid. I am running into trouble with the Endpoint when importing the csv. Is there an easy way to do this?

My code:

$trustList = Get-ChildItem -Path $path -Recurse -Filter “Domain_Trusts_*”

$CountTrust = $trustList.count

foreach ($trust in $trustlist <#| Select -first 1#>)



    $temp1 = $

    $temp2 = ($temp1.split("_"))[2]

    $trustName = $temp2.substring(0,$temp2.Lastindexof('.'))    

    $Filepath = $path+$temp1 


    New-UDRow -columns{

        New-UDColumn -SmallSize 12 -Content {


            New-UDGrid -Title $trustName -Headers @("Domain Source","Target","Direction","Trust Type","Forest Transitive","Intra Forest","Is Tree Parent","Is Tree Root","Selective Authentication","Sid Filtering Forest Aware","Sid Filtering Quarantined","Disallow Transivity","Trust Attributes") -Properties @("DomainSource","Target","Direction","TrustType","ForestTransitive","IntraForest","IsTreeParent","IsTreeRoot","SelectiveAuthentication","SidFilteringForestAware","SidFilteringQuarantined","DisallowTransivity","TrustAttributes") -AutoRefresh -RefreshInterval 60 -Endpoint {

                 ($temp1 = Import-CSV $filepath) | Sort-Object -Property "Domain Source" |  Select * | Out-UDGridData


            }   ##End New-UDGrid


           }   ## End New-UDColumn 


    } ## End New-UDRow two


}  ## End for-each

In the past I have just merged all the CSV files into one CSV using powershell then display the one merged CSV.

Thanks psDevUK.

This is an option. Ideally, I’m looking to display each separate domain in it’s own Row with a UDGrid. For now I’ve done this manually per domain, and have eliminated the loop. Was just curious if it was possible to display using a loop, as we plan to add new domain files, and having the loop would eliminate me having to manually add the UD-Grid for each new domain file.