How to read csv/json and passing to figma plugin

Dear All

I have a sample figma as below

I am trying to export each of them individually as a png.

So for example,

This will show only main frame, red rectangle container and rect rectangle only and I can export the image now.

I do this using a plugin I found online in github

It is working fine.

What I wish to add is that, this “hide other layers”, and “show a specific layer” logic I need to read from a csv file(or json).

I am using
a) figma desktop
b) npm 6.14.15
c) typescript Version 4.9.5

I wish to have a figma UI where I can browse a csv file/json file from my laptop drive and based on the rules, iterate rules to hide and show different combinations to download png/svg. I am not expecting a full logic reply in this thread :slight_smile: But, wish to know how can I import a csv/json.

@Gleb any advice?


Using the File API, web content can ask the user to select local files and then read the contents of those files. This selection can be done by either using an HTML <input type="file"> element or by drag and drop.