ive used col.ToString.Replace(vbCrLf, “”) in for each column, and it worked as expected when i write range to excel. however, when i paste it in google sheet it is still with the initial format.
i solved it with outputting the dt into string, do regex to remove breakline with space, and converting back to dt.
pretty sure theres better way to do this but this is working for my specific case
Give this a try in invoke code passign your dt as in/out arguement
Dim row As system.data.DataRow
Dim col As system.data.DataColumn
For Each row In dt.Rows
For Each col In dt.Columns
If row(col.ColumnName).ToString().Contains(vbLf) Or row(col.ColumnName).ToString().Contains(vbCr) Then
row(col.ColumnName) = row(col.ColumnName).ToString().Replace(vbLf, "").Replace(vbCr, "")
End If
Next
Next