-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
72 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,81 @@ | ||
# xlscfg | ||
# xlsxcfg | ||
|
||
config data from excel sheets | ||
xlsxcfg load config data from excel sheets. | ||
|
||
# Examples | ||
## Installation | ||
|
||
*⚠Currently needs golang sdk* | ||
|
||
Run the following command: | ||
|
||
`go install github.com/dashengyeah/xlsxcfg/bin/xlsxcfg` | ||
|
||
## Config | ||
|
||
Default config file `xlsxcfg.yaml`: | ||
|
||
```yaml | ||
# Protocol Buffer source config | ||
proto: | ||
# proto files need to parse. | ||
files: ["example.proto"] | ||
# proto message import paths. | ||
import_path: ["."] | ||
# xlsx sheet config | ||
sheet: | ||
# rows that is comment, will ignore | ||
# in parsing | ||
comment_rows: [1] | ||
# row contains metadata | ||
meta_row: 2 | ||
# rows contain config data from this | ||
data_row_start: 3 | ||
# sheet name should add this suffix | ||
# to find the proto message. | ||
type_suffix: "Sheet" | ||
# config data rows' list name in the | ||
# sheet proto message. | ||
list_field_name: "List" | ||
# sheet name should add this suffix | ||
# to find the data row proto message. | ||
row_type_suffix: "SheetRow" | ||
# output file config | ||
output: | ||
# output dir | ||
dir: "." | ||
# json | ||
write_json: true | ||
json_indent: " " | ||
# proto bytes | ||
write_bytes: true | ||
``` | ||
## Examples | ||
1. Basic | ||
- Protocol Buffer code: | ||
```protobuf | ||
message PhoneNumber { | ||
int64 Region = 1; | ||
int64 No = 2; | ||
string Ext = 3; | ||
} | ||
|
||
message MemberSheetRow { | ||
int32 ID = 1; | ||
string Name = 2; | ||
string Address = 3; | ||
int32 ID = 1; | ||
string Name = 2; | ||
string Address = 3; | ||
PhoneNumber Phone = 4; | ||
repeated string Cities = 5; | ||
repeated PhoneNumber PP = 6; | ||
} | ||
message MemberSheet { | ||
repeated MemberSheetRow List = 1; | ||
repeated MemberSheetRow List = 1; | ||
} | ||
``` | ||
|
||
- Excel sheet: | ||
|
||
![image](./doc/example-sheet.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.