Concepts
Terminology
Basics
| Term | Definition |
|---|---|
Workbook | An excel file. A bundle of CSV files named with the same prefix seperated by #.A XML file. A YAML file. |
Worksheet | A sheet in a excel file. A CSV file. A root node of a XML file. A document in YAML file. |
Metasheet | A worksheet named @TABLEAU to specify tableau parser options. |
Row | The row in a sheet. |
Column | The column in a sheet. |
Cell | The intersection of a row and a column. |
In-cell | The inner-side of a cell. |
Cross-cell | Continuous cells of a row or a column. |
Worksheet
| Term | Definition |
|---|---|
Namerow | Exact row number of column name definition at a worksheet. â ī¸ NOTE: each column name must be unique in a worksheet! Default: 1. |
Typerow | Exact row number of column type definition at a worksheet. Default: 2. |
Noterow | Exact row number of column note at a worksheet. Default: 3. |
Datarow | Start row number of data at a worksheet. Default: 4. |
Nameline | The line number of column name definition in a cell. 0 means the whole cell.Default: 0. |
Typeline | The line number of column type definition in a cell. 0 means the whole cell.Default: 0. |
Sep | Separator for: 1. separating in-cell list elements. 2. separating in-cell map items. Default: ,. |
Subsep | Subseparator for separating in-cell map Key-Value pair. Default: :. |
Nested | Nested naming of the namerow. Default: false. |
Layout | Incell, vertical(cross-cell) or horizontal(cross-cell). |
Transpose | Interchanging the rows and columns of a given sheet. |
Mappings to Protoconf
| Term | Protoconf |
|---|---|
Workbook | One protoconf(.proto) file. |
Worksheet | One top-level message in a protoconf file, except the tableau metasheet named @TABLEAU. |
column | One field in a message |
A simple mapping example
Input: an excel file
A workbook(HelloWorld.xlsx) with two data worksheets(ItemConf and ActivityConf) and an empty tableau metasheet(@TABLEAU).
| ID | Name | Type |
|---|---|---|
| map<uint32, Item> | string | int32 |
| Item’s ID. | Item’s name. | Item’s type. |
| 1 | item1 | 100 |
| 2 | item2 | 200 |
| 3 | item3 | 300 |
| ID | Name | Open |
|---|---|---|
| map<uint32, Activity> | string | bool |
| Activity’s ID. | Activity’s name. | Activity is open? |
| 1 | activity1 | true |
| 2 | activity2 | false |
| 3 | activity3 |
Output: a protoconf file
A protoconf file(hello_world.proto) with two top-level messages(ItemConf and ActivityConf).
hello_world.proto
syntax = "proto3";
package protoconf;
option go_package = "github.com/tableauio/demo/examples/helloworld/protoconf";
import "tableau/protobuf/tableau.proto";
option (tableau.workbook) = {name:"HelloWorld.xlsx" namerow:1 typerow:2 noterow:3 datarow:4};
message ItemConf {
option (tableau.worksheet) = {name:"ItemConf"};
map<uint32, Item> item_map = 1 [(tableau.field) = {key:"ID" layout:LAYOUT_VERTICAL}];
message Item {
uint32 id = 1 [(tableau.field) = {name:"ID"}];
string name = 2 [(tableau.field) = {name:"Name"}];
int32 type = 3 [(tableau.field) = {name:"Type"}];
}
}
message ActivityConf {
option (tableau.worksheet) = {name:"ActivityConf"};
map<uint32, Activity> activity_map = 1 [(tableau.field) = {key:"ID" layout:LAYOUT_VERTICAL}];
message Activity {
uint32 id = 1 [(tableau.field) = {name:"ID"}];
string name = 2 [(tableau.field) = {name:"Name"}];
bool open = 3 [(tableau.field) = {name:"Open"}];
}
}