I have the below code to convert from html table to csv. But somehow if there is any "," in the table cell data.. it truncates the table cell and creates a new column.. how can i make sure if the table cell data doesnt truncates if it contains "comma"..
$r = Invoke-WebRequest 'https://htmlwithtable.htm'
$data = ( $r.ParsedHtml.getElementsByTagName("table") | Select-Object -First 1 ).rows
$table = @()
forEach($datum in $data){
if($datum.tagName -eq "tr"){
$thisRow = @()
$cells = $datum.children
forEach($cell in $cells){
if($cell.tagName -imatch "t[dh]"){
$thisRow += $cell.innerText
}
}
$table += $thisRow -join ","
}
}
$table | out-file c:\change\htmltocsv.csv -Encoding ascii