I have tried few shell scripts to convert to a HTML table format but I didnt get desired output. Could anyone help here to convert CSV to a HTML table format using Python or
This is easy with PowerShell. You can use the ConvertFrom-Csv cmdlet to convert your csv to a object array and use the ConvertTo-Html cmdlet to convert it to a html table. To store the html, use the Set-Content cmdlet:
$myCsv =
@'
Id, Name
1, Hello
2, World
'@
$myCsv | ConvertFrom-Csv | ConvertTo-Html | Set-Content -Path 'YOUR_PATH_HERE.csv'
Output:
HTML TABLE
Id Name
1 Hello
2 World
Note: If you need to load the csv from a file, you can either use the Get-Content cmdlet to load it and convert it using the example above, or you can use the Import-Csv cmdlet.