Skip to content

Using Python, convert an Excel document to JSON

License

Notifications You must be signed in to change notification settings

setion/excel2json

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

本代码在 https://github.com/paceaux/xlsx-to-json 的基础上进行更改

  1. 增加对数据类型的处理,当前从第4行开始读取数据

典型数据格式如下:

第一行:字段名

第二行:字段类型

第三行:字段名解释

image

目前支持的类型有:number/int, float, array/list, boolean/bool, string, object

  1. 支持整表导出和按sheet导出
  2. 本次修改基于自身项目需求更改,若无法满足其他项目,还望自行修改。

xlsx-to-json

Using Python, convert an Excel (xlsx or xls) document to JSON

dependencies

  • pylightxl
  • xlrd

you can run pip3 install pylightxl xlrd in your terminal/command window if you don't have these dependencies installed

Usage

  • Run the command python3 xlstojson.py in your terminal/command window
  • Do what the prompt says (which is enter the path to the file)

A .json file matching the name of your xlsx document will be generated.

Caveats and Whatnots

I wrote this six years ago; it was the first thing I'd ever written in Python. This code was written about as well as a non-Python programmer programming Python could write it.

I have made attempts to improve it, but I may still not know what I'm doing

About

Using Python, convert an Excel document to JSON

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%