Spreadsheet Lookup
基於相關的文字字串(鍵)在電子表格資料中查找值。這在許多圖層共享共同屬性的 design systems 中可能很有用。例如,在下表中,key corner-radius 將返回一個 value 為 10。
| Key | Value |
|---|---|
| corner-radius | 10 |
使用查找的優點是,行可以出於組織目的移動,而不會丟失與值的連結。
File - 連接一個 .csv 或 Google Sheet Asset。
Excel Sheet - 從 .xlsx 資產中選擇一個 sheet(標籤頁)。
Lookup Column - 選擇資料中要搜尋鍵的列。
Lookup Key - 指定要在 Lookup Column 中查找的鍵(文字)。
Value Column - 選擇要與 Lookup Key 匹配的列。
- 建立一個 Rectangle。
- 在 Assets Window 中右鍵點擊,選擇 Import Google Sheet…
- 貼上此 url - https://docs.google.com/spreadsheets/d/1DB4Yv0W_sT1nIlKiQFUBeQyXZoz88tdQt8YvLzXYwbU/edit?usp=sharing
- 建立一個 Spreadsheet Lookup。
- 將 Google Sheet 從 Assets Window 拖到 Spreadsheet Lookup 上的 File 屬性。
- 為 Lookup Column 選擇
Key列。 - 為 Value Column 選擇
Value列。 - 在 Lookup Key 中輸入
corner-radius。 - 連接 spreadsheetLookup.id→rectangle.cornerRadius。
對電子表格中資料的任何更改都需要透過在 Asset Window 中右鍵點擊電子表格 Asset 並選擇 Reload 來更新。