Jump to content
Software FX Community

Reading a remote CSV


IGSFX

Recommended Posts

- Create a script called ImportCsvWeb.ps1 with the following

$url = $args[0]
$tempFile = [system.IO.Path]::GetTempFileName()
$webClient = new-object System.Net.WebClient
$webClient.DownloadFile($url,$tempFile)
$data = import-csv $tempFile
[system.IO.File]::Delete($tempFile)
$data

- Invoke it in a powershell session (or script) as follows

.\importcsvweb.ps1 "http://<your csv file URL>" | out-chart -values <ValueColumns> -label <LabelColumn>

Note that in this case we let ImportCsvWeb to return the data without any "casting" to allow reuse of this script with multiple CSV files. You tell the out-chart cmdlet which fields should be plotted through the -values parameter (which must contain only numbers)

post-4782-13922403284035_thumb.jpg

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...