Giter VIP home page Giter VIP logo

xlsxtomysql's Introduction

Excel(xlsx)导入MySQL数据库

简介

这是工作中用到的一个小工具,将Excel(xlsx)表导入MySQL表中,用Golang写的,每条记录单独一条 goroutine 处理,提高效率。支持随机数生成、密码生成、时间戳;支持关联查询、附表操作等。

使用方法

  1. 使用Go编译安装或直接下载:https://github.com/TargetLiu/xlsxtomysql/releases

  2. 使用命令: xlsxtomysql [DSN] [数据表名称] [*.xlsx]

更新

v0.1.2

修复bug

v0.1.1

修复bug,优化并发

DSN

格式:

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

示例:

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

注意: Linux、Mac下可能需要输入 \( \)

Excel表导入结构说明

  1. 只支持单Sheet

  2. 第一行对应数据库表字段

  • 通过 | 分割

  • 字段名|unique 判断重复,重复的自动跳过

  • 字段名|password|[md5|bcrypt] 密码生成,第二个参数[md5|bcrypt]

  • 字段名|find|表名|需要获取的字段|查询字段 根据内容从其它表查询并获取字段,格式 SELECT 需要获取的字段 FROM 表名 WHERE 查询字段 = 内容

  • :other 附表操作

  1. 内容行
  • :random 生成随机字符串

  • :time 当前unix时间戳

  • :null 空值,自动跳过该值,一般可用于自增id

  • 如果该列为 password ,内容为[明文密码]或[明文密码|盐],盐可以通过[:字段名]获取之前的字段名。密码将自动根据字段名中填写的加密方式进行加密

  • 如果该列为 other , 格式[表名|字段1|字段2|字段3....] 其它表需要按顺序为每个字段添加内容。字段可以为[:null|:id(主表生成的自增ID)|:random|:time]

Excel截图

Excel截图

关于作者

我的博客:http://targetliu.com/

GitHub:https://github.com/TargetLiu

xlsxtomysql's People

Contributors

targetliu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

xlsxtomysql's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.