Below is my code to export rich text content to a .CSV file. The content comes from a SharePoint list. I am using CAML to fetch the content and adding it to $Content
.
This code exports the data but in an unexpected format - Single value gets exported to multiple rows, the exported content should be in one row.
$Extract = "C:\Logs\KBExtract\MyExtract.csv"
$Content = "<p>This is a test RTF</p>
Hi! I’m a test file. This is some bold text, and some italic text, as well as some underline text. And a bit of text. So we’re going to end this paragraph here and go on to a nice little list:
<p> </p>
<p>•Item 1</p>
<p>•Item 2</p>
<p>•Item 3</p>
<p>•Item 4</p>
<p> </p>
<p>And now comes a fun table:</p>
<p> </p>
<p>Cell 1Cell 2</p>
<p>More in cell 2Cell 3</p>
<p>Next rowNext row Next row</p>
<p> </p>
<p>A page break:</p>
<p> </p>
<p>";
New-Object -TypeName PSCustomObject -Property @{
RichText = $Content
} | Export-Csv -Path $Extract -NoTypeInformation -Append
Is this due to commas in my content? I have around 50,000 rich text values to be exported into 50,000 rows in .CSV file. But content gets mixed within the rows. What is the best way to handle this?