Import-csv to table in Dashboard

Hi, sorry is this a really basic question, but it’s driving me a little crazy. I’m just trying to display a simple csv in a table on a new dashboard, but it is not working. I feel like it should be really simple, so I must be missing something.

New-UDDashboard -Title “BlahBlahBlah” -Content {

$Data = Import-Csv -Path “.\pathtofile\test.csv” | Select-Object test1, test2
$Columns = @(
New-UDTableColumn -Property test1 -Title MyTest1
New-UDTableColumn -Property test2 -Title MyTest2
New-UDTable -Id ‘awesometable’ -Data $Data -Columns $Columns -Title ‘MyTestTable’

1 Like

an you share the csv file ?

It’s pretty simple.

test1, test2
first, second

I just tried my own CSV. Just get rid of the | Select-Object test1, test2 and it should work.

It does! See something simple. Thank you.

Also, another issue I was running into was the fact that PU runs as SYSTEM. So when I had tried grabbing the csv from a shared folder location it was failing.

Appreciate you guys!

Are you grabbing the csv from inside your dashboard code or a scheduled script in PowerShell Universal? I have had better luck creating a script that copies the csv file from the original location to the PowerShell Universal server using a variable with a username/password that has access to the share. Then import from that location on PowerShell Universal Server. At least that is my advice. Probably an easier way from the more experience guys on here.