Git Product home page Git Product logo

excel-mysql-tool's Introduction

Excel-MySQL-tool

✨Excel一键导入MySQL数据库,MySQL数据库一键读取到Excel表格。

依赖

  • Python2.7.11 环境
  • xlrd
  • xlwt
  • MySQLdb

mysql-->>excel

  • 首先将readout.py导入到你的工作目录下

  • host 数据库访问链接,远程的使用IP也是可以的

  • user 数据库用户名

  • password 数据库密码

  • db 要操作的数据库名称

  • output_file excel文件输出完整路径

  • 然后使用如下的调用语句即可。

# 结果测试
if __name__ == "__main__":
    export('localhost','root','mysql','test','datetest',r'datetest.xlsx')
    

excel -->> MySQL

  • 首先也是导入xlsx2sql.py
  • 然后就可以使用如下的语句来实现咯。
from xlsx2sql import XlsxTool,Xlsx2sql
tool = XlsxTool()
table_header_type = ['int(100) not null','varchar(255) ','varchar(255)','varchar(255)','varchar(30)','varchar(30)','varchar(100) not null']
release = Xlsx2sql(tool)
release.generate(r'./readout.xlsx',table_header_type,"id",r'./readout.sql')

案例展示

图片展示

由于数据库输出到excel比较简单,这里就简单的展示一下excel转换成数据库的案例吧。

  • excel原始内容 Excel数据源

  • 运行完刚才的示例代码后会在当前目录下生成一个readout.sql文件,复制里面的内容到数据库中。 输出结果

excel-mysql-tool's People

Contributors

guoruibiao avatar ivysrono 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  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  avatar  avatar  avatar

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.