Argument List
x2f [ input ] [ flatc options ] [ xlsx-fbs options ]
input Options
Excel file path or folder path containing Excel files. If a file is passed, it converts a single table; if a path is passed, it recursively converts all tables in the folder. If not passed, it defaults to converting all tables in the execution path of x2f
.
flatc Options
For the list of supported code languages and complete parameters for flatc, please refer to the FlatBuffers documentation. xlsx-fbs will pass the parameters to flatc. Here are some commonly used ones:
-
--cpp --csharp --ts --java
etc., generate code for the corresponding language. -
--gen-onefile
Generate single output file per table for C#, Go, and Python.
xlsx-fbs Options
-
-o, --output <path>
Output path, defaults tooutput/
in the folder wherexlsx-fbs
is executed. -
-n, --namespace <name>
Namespace for generated code, defaults toXlsx
. -
-k, --default-key <field>
By default, no key attribute is used. If passed, if no field in the table has the key attribute set, this field will be used as the key. -
--binary-extension <ext>
Suffix for output binary files, defaults to bin. You can go crazy and fill in wtf.bytes if you want. -
--censored-fields <fields>
Censored fields, connected with,
. Will generate a censored version of the file to theoutput_censored/
directory. (Note: This is not deleting data, but removing the entire field from the .fbs file!) -
--censored-output <path>
Specify the output path for censored tables, defaults to${output}_censored/
. -
--output-bin <path>
Copy output bin to specified path. This type of copy parameter is only available for batch table generation, and will preserve files in the original output path. -
--output-csharp <path>
Copy output code to specified path, using C# as an example. Replace with corresponding language name for others. -
--censored-output-bin <path>
Copy censored version output bin to specified path. -
--censored-output-csharp <path>
Copy censored version output code to specified path, using C# as an example. Replace with corresponding language name for others. -
--clean-output
Force clear output directory before batch table generation. Use with caution, don't accidentally delete innocent files. -
--empty-string
By default, string type fields in the table are filled with empty strings instead of null when creating binaries. -
--disable-merge-table
When batch generating tables, if themerge
field is configured in the configuration table, code and binaries formergeTable
will be generated by default. This feature can be disabled if not needed. -
--disable-incremental
Batch table generation has incremental generation enabled by default, but can be manually disabled. -
--enable-streaming-read
Enable streaming read for .xlsx format. Fast, small memory usage, but Chinese characters might be garbled😠, and there's an unstable bug where data might become sharedString. Suggest not using for now, wait for ExcelJS project to fix. -
--table-class-suffix <suffix>
Suffix for generated table class names, defaults to empty string. For example, the table class name generated fromitem.xlsx
would beItem
. -
--data-class-suffix <suffix>
Suffix for generated table data class names, defaults toInfo
. For example, the data class name generated fromitem.xlsx
would beItemInfo
. Must avoid having tables named with class suffix endings. For example, when batch generating tables, if there are bothdrop.xlsx
anddropInfo.xlsx
in the directory, the data class name of the first table will conflict with the class name of the second table, BOOM💥. -
--multi-thread <number>
Number of threads for batch table generation, defaults to 6. -
--minimal-info
Minimize output information, optional rangelog < info < warn < error
, defaults toinfo
. -
--allow-wild-table
Allow wild tables (tables not configured in $tables.xlsx) during batch table generation. Use with caution, ensure no strange things are generated.infoProperty Sheet Default Values:
- A: Data sheet field name (can be filled freely, maps to property sheet, and serves as field name comments in generated .fbs)
- B: Field variable name (corresponds to field in .fbs, and member field name in code)
- C: Field type (
short
,int
,string
... etc.) - D: Field default value (corresponds to default value in .fbs)
- E: Field attributes (corresponds to Attributes in .fbs)
-
--property-order
Customize property sheet order, defaults to ABCDE. Can be defined according to the actual column order in the table. For example, if you want to use the field name in column A of the table property sheet as the variable name, column B already defines the type, and column C is occupied by comments, then pass AABDE. The order corresponds to field name -> variable name -> type -> default value -> attributes. -
--csharp-unity-loader
Generate Unity table loader class. Data sheet needs to configure int type id field. -
--csharp-unity-loader-suffix
Table loader class suffix, defaults toTable
. For brevity, you can uses
. -
--js
Package js. Use.js
for browser,.cjs.js
or.esm.js
for node. -
--js-sourcemap
-
--js-exclude-flatbuffers
Remove flatbuffers code from packaged js, ensure correct external import. -
--js-browser-target <target>
Defaults toes2017
, you can research what to pass yourself, use,
to connect, for example--js-browser-target "es2020,chrome58,edge16,firefox57"
-
--js-node-target <target>
Defaults tonode20
.