Naming your Figma layers
This is the key part of this whole plugin!!
There's 3 key parts about how you name your layer that will tell the Plugin:
- 1.Which Worksheet within your Google Sheets file to look at (e.g if there's multiple tabs in the Sheets file)
- 2.Which Label to use in the Worksheet to lookup the value
- 3.Which Value within all the values for that given Label should it used (e.g which index to use)
To specify which label to lookup, simply include a
#in your Figma's layer name, followed by the Label name.
Looking at this example below, let's say I wanted to get the content of Title to be used in the Figma Text Layer — I would name the Figma layer
The plugin will assume anything after a
#is specifying the label to lookup.
#is used in a Figma Layer name, then no value from the Sheet will be applied to it.
You can use the 'Fetch' feature to make re-naming even easier; learn more in the 'Running the plugin' section
By default, Google Sheets Sync will use the first Worksheet in your Google Sheets file.
If you want to specify a specific Worksheet to be used for the values, you can name your layers/pages, similarly to how you specify the correct Label to lookup (as per above) — but instead of using a
//followed by the Worksheet name.
For example; naming your Figma Page
Page 1 // Properties— the plugin will use the Worksheet named Properties when populating the content on that Page.
By default, Google Sheets Sync will automatically get the next value for the specified Label each time it comes across a Figma layer with the same Label in it's name.
For example; the first time it encounters a Layer's name containing
#Title, it will grab the 1st value under the row/column Labelled 'Title'. And for the next Layer it will use the 2nd value, and the next the 3rd and so on...
You can specify the row/column the content is synced from within a specific lookup label, by naming your layer correctly.
.4to the layer name will return the 4th value for that lookup label,
.9will return the 9th, and so on.
Example layer names:
#Title.1– Will return the 1st value under the label 'Title'
#Subtitle.5– will return the 5th value under the label 'Title'
Apart from specifying the exact row/column value to use, there's a couple of other Index types you can use.
.nwill make sure the value of your layer increments its index each time the Label is used (this is what is used by default)
In this scenario you could have blank values in your sheet which could be included as part of incrementing the Index. If you want to ignore blank values, and increment individually for the given key, append
.iin the layer name.
To choose a random index within all the possible indexes, append
.nthis may include blank values, if your column/row for the given layer has blacnk values. To choose a random index that will ignore blank values, use
If you want to ignore layers (and all their children); prefix
-to the start of the layer name.
For example if I have a Frame containing a design that I want to be ignored from syncing any content, it may be named something like
This concept can be applied on names of Pages too.