Parsing uploaded files with code.

Hi… I want to know more about using custom functions & code in plasmic.

So basically I have added an upload component for uploading excel, csv & txt files. Now I want to parse it in the browser using the upload file interaction.

So how do i parse these files using code & convert them into json ?

are you using the builtin upload component? If so, the content is in base64-encoding. You can decode it with globalThis.atob(...)

Hey when I am trying to do so… I am getting this error …

const file = $state.upload.files[0];
const parsedfile = globalThis.atob(file);

error

Failed to run this action
Failed to execute ‘atob’ on window. The string to be decoded is not correctly encoded.

I think it should be $state.upload.files[0].contents