How would I convert CSV data stored in the VersionData
field of object ContentVersion
into a CSV String.
According to the documentation:
The field VersionData
is of type base64
So how to I convert that into a human readable string:
String contents = (?) contentVersions[0].VersionData;
Using EncodingUtil.Base64Encode
String contents = EncodingUtil.Base64Encode(contentVersions[0].VersionData);
Does not return the CSV data, it returns this data:
T1BQT1JUVU5JVFlJRCxQ...
When I am expecting:
field1__c, field2__c, field3__c...