Hi,
I ran a curl statement and populated a variable named $output.
Inside the $output variable are values which are comma separated with no headers. I would like to create an html file showing the list of values.
$output contains something like the following, including the quotation marks:
I have tried everything. The only success I had in actually getting the data out was to export it to a txt file using:
$output | out-file c:\scripts\output\k.txt
Now I have a file which looks exactly like the content of $object, but I am unable to format it in any other way. If I had headers I suppose it might be easier.
To me, it looks more like a list of values than a CSV object where headers would be appropriate. However, if you know what headers should be associated with those values, then you can use ConvertFrom-Csv:
Thanks Both!
Dave’s worked because it listed the 30 or so values into a list. The last part of this is to export it to an html file… I just tried to pipe to format-list then convertto-html but the values show up as Microsoft.PowerShell.Commands.Internal.Format.RawTextFormatEntry.
Can you explain the current format after I execute the $array = $output -split ‘\s*,\s*’ -replace ‘^“|”$’ … What is convertto-html expecting?
Don’t use Format-List here; just pipe objects straight to ConvertTo-Html. In this case, you probably need to construct objects out of your strings, as well, or you will probably get weird results: