Skip to main content

一个 excel 便捷读取插入工具

Project description

gexcel

一个 excel 便捷读取插入工具,有如下三个模块

  • ExcelReader:读取数据(自适应 xlsx、xls)
  • ExcelWriter:保存数据(可能会存在丢失长度问题)
  • ExcelWriterPerfect:保存数据(不会丢失)

安装

pip install gexcel

示例

ExcelReader

自适应 xlsx、xls
打开失败很大概率是文件自身的类型和后缀不符

from gexcel import ExcelReader

reader = ExcelReader('Result.xlsx')
for i in reader.read_lines():   # 可以输入 sheet 获取 sheet索引 来输出
    print(i)

ExcelWriter

from gexcel import ExcelWriter

excel = ExcelWriter()
writer = excel.writer(sheetname='Sheet')    # sheetname 可以不给

for i in range(10):
    writer.write_line([i])

excel.save('Result.xlsx')

ExcelWriterPerfect

from gexcel import ExcelWriterPerfect

excel = ExcelWriterPerfect('Result.xlsx')
writer = excel.writer(sheetname='Sheet')    # sheetname 可以不给

for i in range(10):
    writer.write_line([i])

excel.save()

注意:

这里的 writer 是线程安全的,一个 writer 代表一个 sheet

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

gexcel-1.0.6.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file gexcel-1.0.6.tar.gz.

File metadata

  • Download URL: gexcel-1.0.6.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.2

File hashes

Hashes for gexcel-1.0.6.tar.gz
Algorithm Hash digest
SHA256 5e2bbb0660a702ce57af54679ddd05528a64fa15ba5882500b3c7508c8acbf43
MD5 4209496b3718c26afc26f1ba6155bf87
BLAKE2b-256 9043694999f369129cfac637dd9f533bf996239966d39f533442d47ccbeff4aa

See more details on using hashes here.

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