KeyedList
This guide demonstrates different features of excel keyed list type.
Syntax
Keyed list is same as normal list, except that ColumnType (first field type) is surrounded by angle brackets <>, and is treated as map key.
Syntax: [ElemType]<ColumnType>
Horizontal list
TODO…
Vertical KeyedList
Vertical scalar KeyedList
It’s defined same as Incell scalar KeyedList, but will aggregate multiple rows if provided.
A worksheet ItemConf in HelloWorld.xlsx:
| ID | 
|---|
| []<uint32> | 
| ID | 
| 1,2,3 | 
| 4,5 | 
| 6 | 
Generated:
hello_world.proto
// --snip--
option (tableau.workbook) = {name:"HelloWorld.xlsx" namerow:1 typerow:2 noterow:3 datarow:4};
message ItemConf {
  option (tableau.worksheet) = {name:"ItemConf"};
  repeated uint32 id_list = 1 [(tableau.field) = {name:"ID" key:"ID" layout:LAYOUT_INCELL}];
}
ItemConf.json
{
    "idList": [
        1,
        2,
        3,
        4,
        5,
        6
    ]
}
Vertical enum KeyedList
It’s defined same as Incell enum keyedList, but will aggregate multiple rows if provided.
FruitType in common.proto is predefined as:
enum FruitType {
  FRUIT_TYPE_UNKNOWN = 0 [(tableau.evalue).name = "Unknown"];
  FRUIT_TYPE_APPLE   = 1 [(tableau.evalue).name = "Apple"];
  FRUIT_TYPE_ORANGE  = 3 [(tableau.evalue).name = "Orange"];
  FRUIT_TYPE_BANANA  = 4 [(tableau.evalue).name = "Banana"];
}
A worksheet ItemConf in HelloWorld.xlsx:
| Type | 
|---|
| []<enum<.FruitType>> | 
| Type | 
| Apple,Orange | 
| FRUIT_TYPE_BANANA | 
| 0 | 
Generated:
hello_world.proto
// --snip--
option (tableau.workbook) = {name:"HelloWorld.xlsx" namerow:1 typerow:2 noterow:3 datarow:4};
message ItemConf {
  option (tableau.worksheet) = {name:"ItemConf"};
  repeated protoconf.FruitType type_list = 1 [(tableau.field) = {name:"Type" key:"Type" layout:LAYOUT_INCELL}];
}
ItemConf.json
{
    "typeList": [
        "FRUIT_TYPE_APPLE",
        "FRUIT_TYPE_ORANGE",
        "FRUIT_TYPE_BANANA",
        "FRUIT_TYPE_UNKNOWN"
    ]
}
Vertical struct KeyedList
For example, a worksheet ItemConf in HelloWorld.xlsx:
| ID | PropID | PropName | 
|---|---|---|
| [Item]<uint32> | map<int32, Prop> | string | 
| Item’s ID | Prop’s ID | Prop’s name | 
| 1 | 1 | sweet | 
| 2 | 1 | sweet | 
| 2 | 2 | delicious | 
Generated:
hello_world.proto
// --snip--
option (tableau.workbook) = {name:"HelloWorld.xlsx" namerow:1 typerow:2 noterow:3 datarow:4};
message ItemConf {
  option (tableau.worksheet) = {name:"ItemConf"};
  repeated Item item_list = 1 [(tableau.field) = {key:"ID" layout:LAYOUT_VERTICAL}];
  message Item {
    uint32 id = 1 [(tableau.field) = {name:"ID"}];
    map<int32, Prop> prop_map = 2 [(tableau.field) = {key:"PropID" layout:LAYOUT_VERTICAL}];
    message Prop {
      int32 prop_id = 1 [(tableau.field) = {name:"PropID"}];
      string prop_name = 2 [(tableau.field) = {name:"PropName"}];
    }
  }
}
ItemConf.json
{
    "itemList": [
        {
            "id": 1,
            "propMap": {
                "1": {
                    "propId": 1,
                    "propName": "sweet"
                }
            }
        },
        {
            "id": 2,
            "propMap": {
                "1": {
                    "propId": 1,
                    "propName": "sweet"
                },
                "2": {
                    "propId": 2,
                    "propName": "delicious"
                }
            }
        }
    ]
}
Incell KeyedList
Incell scalar KeyedList
A worksheet ItemConf in HelloWorld.xlsx:
| ID | 
|---|
| []<uint32> | 
| ID list | 
| 1,2,3 | 
Generated:
hello_world.proto
// --snip--
option (tableau.workbook) = {name:"HelloWorld.xlsx" namerow:1 typerow:2 noterow:3 datarow:4}};
message ItemConf {
  option (tableau.worksheet) = {name:"ItemConf";
  repeated uint32 id_list = 1 [(tableau.field) = {name:"ID" key:"ID" layout:LAYOUT_INCELL}];
}
ItemConf.json
{
    "idList": [
        1,
        2,
        3
    ]
}
Incell enum KeyedList
FruitType in common.proto is predefined as:
enum FruitType {
  FRUIT_TYPE_UNKNOWN = 0 [(tableau.evalue).name = "Unknown"];
  FRUIT_TYPE_APPLE   = 1 [(tableau.evalue).name = "Apple"];
  FRUIT_TYPE_ORANGE  = 3 [(tableau.evalue).name = "Orange"];
  FRUIT_TYPE_BANANA  = 4 [(tableau.evalue).name = "Banana"];
}
A worksheet ItemConf in HelloWorld.xlsx:
| Param | 
|---|
| []enum<.FruitType> | 
| Param list | 
| 1,FRUIT_TYPE_ORANGE,Banana | 
The Param column’s type is incell list []enum<.FruitType>, as the list element is the predefined enum type FruitType.
Generated:
hello_world.proto
// --snip--
import "common.proto";
option (tableau.workbook) = {name:"HelloWorld.xlsx" namerow:1 typerow:2 noterow:3 datarow:4};
message ItemConf {
  option (tableau.worksheet) = {name:"ItemConf"};
  repeated protoconf.FruitType type_list = 1 [(tableau.field) = {name:"Type" key:"Type" layout:LAYOUT_INCELL}];
}
ItemConf.json
{
    "typeList": [
        "FRUIT_TYPE_APPLE",
        "FRUIT_TYPE_ORANGE",
        "FRUIT_TYPE_BANANA"
    ]
}