Skip to main content

A tool for excel

Project description

#Demo

##新建Excel文件 import os import jerryExcel

# step 1
excel=jerryExcel.ExcelUtil()
path=os.getcwd()
# 设置文件保存路径
filepath=os.path.join(path,"test.xls")
# 传入文件路径 以及表名
newExcel=excel.NewExcelFile(filepath,"sheet1")

# step 2 准备写入的数据
content=["test1","test2","test3"]
newExcel.write(content)
# 传空值相当于换行
newExcel.write()
newExcel.write(content)
# step 3 保存
newExcel.save()

追加excel数据

# 追加excel文件

# step 1 设置文件路径
excel=jerryExcel.ExcelUtil()
path=os.getcwd()
filepath=os.path.join(path,"test.xls")
addtion=excel.AddtionWrite(filepath)
# step 2 写入数据
content=["test1","test2","test3"]
addtion.write(content)
addtion.write()
addtion.write(content)
# step 3 保存
addtion.save()

读取excel数据

# step 1 设置文件路径
excel = jerryExcel.ExcelUtil()
path = os.getcwd()
filepath = os.path.join(path, "test.xls")
cursor = excel.Cursor(filepath)
# step 2 读取数据
datas = cursor.read(ignoreFirstLine=False, index=0)
# step 3 遍历输出数据
for data in datas:
    print(data)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jerryExcel-1.0.1.tar.gz (2.6 kB view hashes)

Uploaded Source

Built Distribution

jerryExcel-1.0.1-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page