title | description | lead | date | lastmod | draft | images | weight | toc |
---|---|---|---|---|---|---|---|---|
Quick Start |
Quick Start |
One page summary of how to convert a workbook file to proto and JSON files by tableauc. |
2020-11-16 13:59:39 +0100 |
2020-11-16 13:59:39 +0100 |
false |
9902 |
true |
Select the appropriate tableauc (aka Tableau Compiler) to download:
More platforms are available on tableau releases →.
Add HelloWorld.xlsx with two sheets:
Item
: Copy data below to this worksheet.@TABLEAU
: Just leave it empty now. It is the tableau [metasheet →]({{< relref "../excel/metasheet" >}}) for specifying parser options.
{{< spreadsheet "HelloWorld.xlsx" Item "@TABLEAU" >}}
{{< sheet colored>}}
ID | Name | Desc |
---|---|---|
map<int32, Item> | string | string |
Item’s ID | Item’s name | Item’s description |
1 | Apple | A kind of delicious fruit. |
2 | Orange | A kind of sour fruit. |
3 | Banana | A kind of calorie-rich fruit. |
{{< /sheet >}}
{{< sheet >}}
{{< /sheet >}}
{{< /spreadsheet >}}
Run command: ./tableauc HelloWorld.xlsx
Then hello_world.proto and Item.json are generated:
{{< details "hello_world.proto" open >}}
// Code generated by tableau (protogen v0.4.2). DO NOT EDIT.
syntax = "proto3";
package protoconf;
import "tableau/protobuf/tableau.proto";
option (tableau.workbook) = {name:"HelloWorld.xlsx"};
message Item {
option (tableau.worksheet) = {name:"Item" namerow:1 typerow:2 noterow:3 datarow:4};
map<int32, Item> item_map = 1 [(tableau.field) = {key:"ID" layout:LAYOUT_VERTICAL}];
message Item {
int32 id = 1 [(tableau.field) = {name:"ID"}];
string name = 2 [(tableau.field) = {name:"Name"}];
string desc = 3 [(tableau.field) = {name:"Desc"}];
}
}
{{< /details >}}
{{< details "Item.json" open >}}
{
"itemMap": {
"1": {
"id": 1,
"name": "Apple",
"desc": "A kind of delicious fruit."
},
"2": {
"id": 2,
"name": "Orange",
"desc": "A kind of sour fruit."
},
"3": {
"id": 3,
"name": "Banana",
"desc": "A kind of calorie-rich fruit."
}
}
}
{{< /details >}}
Congratulations! You’ve just run the tableauc
to convert a workbook to proto and JSON files.