{"id":27939612,"url":"https://github.com/xuri/excelize-py","last_synced_at":"2025-05-07T09:55:34.132Z","repository":{"id":265655755,"uuid":"893918474","full_name":"xuri/excelize-py","owner":"xuri","description":"Excelize is a Python port of Go Excelize library that allow you to write to and read from XLAM / XLSM / XLSX / XLTM / XLTX files.","archived":false,"fork":false,"pushed_at":"2025-05-04T06:08:32.000Z","size":407,"stargazers_count":13,"open_issues_count":0,"forks_count":13,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-05-04T07:19:35.800Z","etag":null,"topics":["calculation","chart","data-analysis","data-science","data-visualization","ecma-376","excel","excelize","golang","microsoft","office","ooxml","pipy","python","spreadsheet","visualization","xlsm","xlsx","xlsxreader","xlsxwriter"],"latest_commit_sha":null,"homepage":"https://xuri.me/excelize","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xuri.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"xuri","open_collective":"excelize","patreon":"xuri","ko_fi":"xurime","liberapay":"xuri","issuehunt":"xuri","custom":"https://www.paypal.com/paypalme/xuri"}},"created_at":"2024-11-25T12:42:56.000Z","updated_at":"2025-05-04T06:08:35.000Z","dependencies_parsed_at":"2024-12-17T02:46:19.516Z","dependency_job_id":"6b53ed8a-fea9-49eb-8c35-45c4aec5e890","html_url":"https://github.com/xuri/excelize-py","commit_stats":null,"previous_names":["xuri/excelize-py"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuri%2Fexcelize-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuri%2Fexcelize-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuri%2Fexcelize-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuri%2Fexcelize-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xuri","download_url":"https://codeload.github.com/xuri/excelize-py/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252856437,"owners_count":21814853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["calculation","chart","data-analysis","data-science","data-visualization","ecma-376","excel","excelize","golang","microsoft","office","ooxml","pipy","python","spreadsheet","visualization","xlsm","xlsx","xlsxreader","xlsxwriter"],"created_at":"2025-05-07T09:55:33.537Z","updated_at":"2025-05-07T09:55:34.117Z","avatar_url":"https://github.com/xuri.png","language":"Python","funding_links":["https://github.com/sponsors/xuri","https://opencollective.com/excelize","https://patreon.com/xuri","https://ko-fi.com/xurime","https://liberapay.com/xuri","https://issuehunt.io/r/xuri","https://www.paypal.com/paypalme/xuri"],"categories":[],"sub_categories":[],"readme":"# excelize-py\n\n\u003cp align=\"center\"\u003e\u003cimg width=\"500\" src=\"https://github.com/xuri/excelize-py/raw/main/excelize-py.svg\" alt=\"excelize-py logo\"\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://pypi.org/project/excelize\"\u003e\u003cimg src=\"https://img.shields.io/pypi/v/excelize?color=%23007ec6\" alt=\"Pipy version\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/xuri/excelize-py/actions/workflows/build.yml\"\u003e\u003cimg src=\"https://github.com/xuri/excelize-py/actions/workflows/build.yml/badge.svg\" alt=\"Build Status\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://codecov.io/gh/xuri/excelize-py\"\u003e\u003cimg src=\"https://codecov.io/gh/xuri/excelize-py/branch/main/graph/badge.svg\" alt=\"Code Coverage\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://opensource.org/licenses/BSD-3-Clause\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-bsd-orange.svg\" alt=\"Licenses\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.paypal.com/paypalme/xuri\"\u003e\u003cimg src=\"https://img.shields.io/badge/Donate-PayPal-green.svg\" alt=\"Donate\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nPackage excelize-py is a Python port of Go [Excelize](https://github.com/xuri/excelize) library, providing a set of functions that allow you to write and read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and writing spreadsheet documents generated by Microsoft Excel\u0026trade; 2007 and later. Supports complex components by high compatibility, and provided streaming API for generating or reading data from a worksheet with huge amounts of data. This library needs Python version 3.9 or later. The full API docs can be found at [docs reference](https://xuri.me/excelize/).\n\n## Platform Compatibility\n\nOperating system | CPU Architecture\n---|---\nWindows | amd64, arm64, i686\nDarwin | amd64, arm64\nLinux | amd64, arm64, i686\n\n## Basic Usage\n\n### Installation\n\n```bash\npip install excelize\n```\n\n### Create spreadsheet\n\nHere is a minimal example usage that will create spreadsheet file.\n\n```python\nimport excelize\n\nf = excelize.new_file()\ntry:\n    # Create a new sheet.\n    index = f.new_sheet(\"Sheet2\")\n    # Set value of a cell.\n    f.set_cell_value(\"Sheet2\", \"A2\", \"Hello world.\")\n    f.set_cell_value(\"Sheet1\", \"B2\", 100)\n    # Set active sheet of the workbook.\n    f.set_active_sheet(index)\n    # Save spreadsheet by the given path.\n    f.save_as(\"Book1.xlsx\")\nexcept RuntimeError as err:\n    print(err)\nfinally:\n    err = f.close()\n    if err:\n        print(err)\n```\n\n### Reading spreadsheet\n\nThe following constitutes the bare to read a spreadsheet document.\n\n```python\nimport excelize\n\ntry:\n    f = excelize.open_file(\"Book1.xlsx\")\nexcept RuntimeError as err:\n    print(err)\n    exit()\ntry:\n    # Get value from cell by given worksheet name and cell reference.\n    cell = f.get_cell_value(\"Sheet1\", \"B2\")\n    print(cell)\n    # Get all the rows in the Sheet1.\n    rows = f.get_rows(\"Sheet1\")\n    for row in rows:\n        for cell in row:\n            print(f\"{cell}\\t\", end=\"\")\n        print()\nexcept RuntimeError as err:\n    print(err)\nfinally:\n    # Close the spreadsheet.\n    err = f.close()\n    if err:\n        print(err)\n```\n\n### Add chart to spreadsheet file\n\nWith Excelize chart generation and management is as easy as a few lines of code. You can build charts based on data in your worksheet or generate charts without any data in your worksheet at all.\n\n\u003cp align=\"center\"\u003e\u003cimg width=\"650\" src=\"https://github.com/xuri/excelize-py/raw/main/chart.png\" alt=\"Excelize\"\u003e\u003c/p\u003e\n\n```python\nimport excelize\n\nf = excelize.new_file()\ndata = [\n    [None, \"Apple\", \"Orange\", \"Pear\"],\n    [\"Small\", 2, 3, 3],\n    [\"Normal\", 5, 2, 4],\n    [\"Large\", 6, 7, 8],\n]\ntry:\n    for idx, row in enumerate(data):\n        cell = excelize.coordinates_to_cell_name(1, idx + 1, False)\n        f.set_sheet_row(\"Sheet1\", cell, row)\n    chart = excelize.Chart(\n        type=excelize.ChartType.Col3DClustered,\n        series=[\n            excelize.ChartSeries(\n                name=\"Sheet1!$A$2\",\n                categories=\"Sheet1!$B$1:$D$1\",\n                values=\"Sheet1!$B$2:$D$2\",\n            ),\n            excelize.ChartSeries(\n                name=\"Sheet1!$A$3\",\n                categories=\"Sheet1!$B$1:$D$1\",\n                values=\"Sheet1!$B$3:$D$3\",\n            ),\n            excelize.ChartSeries(\n                name=\"Sheet1!$A$4\",\n                categories=\"Sheet1!$B$1:$D$1\",\n                values=\"Sheet1!$B$4:$D$4\",\n            ),\n        ],\n        title=[excelize.RichTextRun(text=\"Fruit 3D Clustered Column Chart\")],\n    )\n    f.add_chart(\"Sheet1\", \"E1\", chart)\n    # Save spreadsheet by the given path.\n    f.save_as(\"Book1.xlsx\")\nexcept RuntimeError as err:\n    print(err)\nfinally:\n    err = f.close()\n    if err:\n        print(err)\n```\n\n### Add picture to spreadsheet file\n\n```python\nimport excelize\n\ntry:\n    f = excelize.open_file(\"Book1.xlsx\")\nexcept RuntimeError as err:\n    print(err)\n    exit()\ntry:\n    # Insert a picture.\n    f.add_picture(\"Sheet1\", \"A2\", \"image.png\", None)\n    # Insert a picture to worksheet with scaling.\n    f.add_picture(\"Sheet1\", \"D2\", \"image.jpg\", excelize.GraphicOptions(\n        scale_x=0.5,\n        scale_y=0.5,\n    ))\n    # Insert a picture offset in the cell with printing support.\n    f.add_picture(\"Sheet1\", \"H2\", \"image.gif\", excelize.GraphicOptions(\n        print_object=True,\n        lock_aspect_ratio=False,\n        offset_x=15,\n        offset_y=10,\n        locked=False,\n    ))\n    # Save the spreadsheet with the origin path.\n    f.save()\nexcept RuntimeError as err:\n    print(err)\nfinally:\n    # Close the spreadsheet.\n    err = f.close()\n    if err:\n        print(err)\n```\n\n## Contributing\n\nContributions are welcome! Open a pull request to fix a bug, or open an issue to discuss a new feature or change.\n\n## Licenses\n\nThis program is under the terms of the BSD 3-Clause License. See [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause).\n\nThe Excel logo is a trademark of [Microsoft Corporation](https://aka.ms/trademarks-usage). This artwork is an adaptation.\n\ngopher.{ai,svg,png} was created by [Takuya Ueda](https://twitter.com/tenntenn). Licensed under the [Creative Commons 3.0 Attributions license](http://creativecommons.org/licenses/by/3.0/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuri%2Fexcelize-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxuri%2Fexcelize-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuri%2Fexcelize-py/lists"}