Using Papaparse in Plasmic Studio

Hi all,

I was wondering if anybody can give me a pointer on how to use PapaParse in Plasmic Studio.
I want to use it to convert a remote CSV to a JSON for use in a Repeat collection.

I looked at other forums and was successfully able to show the results in the console log, but
I can’t figure out how to output it in Plasmic Studio:

$$.papaParse.parse("https://docs.google.com/spreadsheets/d/e/2PACX-1vTSXRg0_sNrBn6vHCLoIGYbPisCzSyl1_sjKf1RLx8X3RTl5qBnbMRnT-cG0y0tUyGtccxzf11N5rFb/pub?gid=0&single=true&output=csv", {
    download: true,
    header: true,
    complete: function(results, file) {
	console.log("Parsing complete:", results, file);}
})

Hello @leafer_design.

Can you send the project URL?
I think that the best thing to do would be to set some state variable in the complete callback.

1 Like

You can use our Side Effect component, and create a Run code interaction on Load to do save the results into an object state variable:

$$.papaParse.parse("https://docs.google.com/spreadsheets/d/e/2PACX-1vTSXRg0_sNrBn6vHCLoIGYbPisCzSyl1_sjKf1RLx8X3RTl5qBnbMRnT-cG0y0tUyGtccxzf11N5rFb/pub?gid=0&single=true&output=csv", {
    download: true,
    header: true,
    complete: function(results, file) {
    $state.variable = results;
	console.log("Parsing complete:", results, file);}
})
1 Like

Thanks! Didn’t realize “Side Effect” could be used to do that