How to Parse CSV with different delimeter and non english charaters

The retool CSV file parser works perfectly fine in most of the cases. However if you run across a special CSV with semicolon instead of comma as the delimiter you might run into some parsing issues. The solution is to use Papa Parse.
{{Papa.parse(atob(,{header:true, delimiter: ";"}).data}}

Now, the atob function might not work if you have some non English characters in your file, like French. You would need to convert your file back to UTF-8 characters. For this you could use the below function instead of the basic atob:

    function b64DecodeUnicode(str) {
       // Going backwards: from bytestream, to percent-encoding, to original string.
       return decodeURIComponent(atob(str).split('').map(function(c) {
       return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);

Welcome to the community @aveek-mukherjee, and thanks for posting this!!

1 Like

Nicely done @aveek-mukherjee! :clap:

1 Like