gexcel


Namegexcel JSON
Version 1.0.6 PyPI version JSON
download
home_pagehttps://github.com/Leviathangk/gexcel
Summary一个 excel 便捷读取插入工具
upload_time2023-03-24 02:54:26
maintainer
docs_urlNone
author郭一会儿
requires_python
licenseMIT Licence
keywords excel openpyxl xlsxwriter
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Leviathangk/gexcel",
    "name": "gexcel",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "excel,openpyxl,xlsxwriter",
    "author": "\u90ed\u4e00\u4f1a\u513f",
    "author_email": "1015295213@qq.com",
    "download_url": "https://files.pythonhosted.org/packages/90/43/694999f369129cfac637dd9f533bf996239966d39f533442d47ccbeff4aa/gexcel-1.0.6.tar.gz",
    "platform": "any",
    "description": "# gexcel\r\n\r\n\u4e00\u4e2a excel \u4fbf\u6377\u8bfb\u53d6\u63d2\u5165\u5de5\u5177\uff0c\u6709\u5982\u4e0b\u4e09\u4e2a\u6a21\u5757\r\n\r\n- ExcelReader\uff1a\u8bfb\u53d6\u6570\u636e\uff08\u81ea\u9002\u5e94 xlsx\u3001xls\uff09\r\n- ExcelWriter\uff1a\u4fdd\u5b58\u6570\u636e\uff08\u53ef\u80fd\u4f1a\u5b58\u5728\u4e22\u5931\u957f\u5ea6\u95ee\u9898\uff09\r\n- ExcelWriterPerfect\uff1a\u4fdd\u5b58\u6570\u636e\uff08\u4e0d\u4f1a\u4e22\u5931\uff09\r\n\r\n# \u5b89\u88c5\r\n\r\n```\r\npip install gexcel\r\n```\r\n\r\n# \u793a\u4f8b\r\n\r\n## ExcelReader\r\n\r\n\u81ea\u9002\u5e94 xlsx\u3001xls  \r\n\u6253\u5f00\u5931\u8d25\u5f88\u5927\u6982\u7387\u662f\u6587\u4ef6\u81ea\u8eab\u7684\u7c7b\u578b\u548c\u540e\u7f00\u4e0d\u7b26\r\n\r\n```\r\nfrom gexcel import ExcelReader\r\n\r\nreader = ExcelReader('Result.xlsx')\r\nfor i in reader.read_lines():   # \u53ef\u4ee5\u8f93\u5165 sheet \u83b7\u53d6 sheet\u7d22\u5f15 \u6765\u8f93\u51fa\r\n    print(i)\r\n```\r\n\r\n## ExcelWriter\r\n\r\n```\r\nfrom gexcel import ExcelWriter\r\n\r\nexcel = ExcelWriter()\r\nwriter = excel.writer(sheetname='Sheet')    # sheetname \u53ef\u4ee5\u4e0d\u7ed9\r\n\r\nfor i in range(10):\r\n    writer.write_line([i])\r\n\r\nexcel.save('Result.xlsx')\r\n```\r\n\r\n# ExcelWriterPerfect\r\n\r\n```\r\nfrom gexcel import ExcelWriterPerfect\r\n\r\nexcel = ExcelWriterPerfect('Result.xlsx')\r\nwriter = excel.writer(sheetname='Sheet')    # sheetname \u53ef\u4ee5\u4e0d\u7ed9\r\n\r\nfor i in range(10):\r\n    writer.write_line([i])\r\n\r\nexcel.save()\r\n```\r\n\r\n# \u6ce8\u610f\uff1a\r\n\r\n\u8fd9\u91cc\u7684 writer \u662f\u7ebf\u7a0b\u5b89\u5168\u7684\uff0c\u4e00\u4e2a writer \u4ee3\u8868\u4e00\u4e2a sheet\r\n",
    "bugtrack_url": null,
    "license": "MIT Licence",
    "summary": "\u4e00\u4e2a excel \u4fbf\u6377\u8bfb\u53d6\u63d2\u5165\u5de5\u5177",
    "version": "1.0.6",
    "split_keywords": [
        "excel",
        "openpyxl",
        "xlsxwriter"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9043694999f369129cfac637dd9f533bf996239966d39f533442d47ccbeff4aa",
                "md5": "4209496b3718c26afc26f1ba6155bf87",
                "sha256": "5e2bbb0660a702ce57af54679ddd05528a64fa15ba5882500b3c7508c8acbf43"
            },
            "downloads": -1,
            "filename": "gexcel-1.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "4209496b3718c26afc26f1ba6155bf87",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4113,
            "upload_time": "2023-03-24T02:54:26",
            "upload_time_iso_8601": "2023-03-24T02:54:26.557403Z",
            "url": "https://files.pythonhosted.org/packages/90/43/694999f369129cfac637dd9f533bf996239966d39f533442d47ccbeff4aa/gexcel-1.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-24 02:54:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "Leviathangk",
    "github_project": "gexcel",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "gexcel"
}
        
Elapsed time: 0.06583s