This is a creation in Article, where the information may have evolved or changed.
Brief introduction
This is a small tool used in the work, the Excel (xlsx) table into the MySQL table, written in Golang, each record a single goroutine
processing, improve efficiency. Support random number generation, password generation, timestamp, support related query, schedule operation, etc.
How to use
Use go to compile the installation or direct download: https://github.com/TargetLiu/xlsxtomysql/releases
Use the command:xlsxtomysql [DSN] [数据表名称] [*.xlsx]
Dsn
Format:
[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...¶mN=valueN]
Example:
root:123@tcp(127.0.0.1:3306)/dbname
Attention:
Linux, Mac may require input\( \)
Excel table Import Structure description
only supports single sheet
The first row corresponds to the database table field
by |
splitting
字段名|unique
Repeat, repeat, auto-skip.
字段名|password|[md5|bcrypt]
Password generation, second parameter [Md5|bcrypt]
字段名|find|表名|需要获取的字段|查询字段
Query and get fields from other tables based on content, formatSELECT 需要获取的字段 FROM 表名 WHERE 查询字段 = 内容
:other
Schedule operation
Content Line
:random
Generate Random string
:time
Current UNIX Timestamp
:null
NULL, which automatically skips this value and is typically used for self-increment IDs
If the column password
contains a [clear text password] or [plaintext password | salt], the salt can get the previous field name by [: Field name]. The password is automatically encrypted according to the encryption method that is filled in the field name
If the column other
is in the format [table name | field 1| field 2| Field 3 ...] Other tables need to add content sequentially for each field. The field can be [: Null|:id (the self-increment ID generated by the primary table) |:random|:time]
Excel
About the author
My blog: http://targetliu.com/
Github:https://github.com/targetliu