Open source A Golang write Excel (xlsx) import MySQL Gadget

Source: Internet
Author: User
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

    1. Use go to compile the installation or direct download: https://github.com/TargetLiu/xlsxtomysql/releases

    2. Use the command:xlsxtomysql [DSN] [数据表名称] [*.xlsx]

Dsn

Format:

[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...&paramN=valueN]

Example:

root:123@tcp(127.0.0.1:3306)/dbname

Attention:
Linux, Mac may require input\( \)

Excel table Import Structure description

    1. only supports single sheet

    2. The first row corresponds to the database table field

      • by | splitting

      • 字段名|uniqueRepeat, 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 查询字段 = 内容

      • :otherSchedule operation

    3. Content Line

      • :randomGenerate Random string

      • :time Current UNIX Timestamp

      • :nullNULL, 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.