excel-convertor


Nameexcel-convertor JSON
Version 1.4.3 PyPI version JSON
download
home_pageNone
Summary엑셀 생성기 from dictionary
upload_time2025-10-22 08:30:42
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2025 Your Name Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords excel xlsx dict json python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ### 개요
xlsxwriter 를 이용하여 엑셀을 보다 쉽게 작성할 수 있도록 도와주는 라이브러리입니다.
헤더 및 스타일 등을 간단히 지정할 수 있습니다.

### 설치
```bash
pip install xlsx-creator
```

### 사용법
- header 의 key 를 기준으로 데이터를 가공하여 엑셀로 저장합니다. `save_to` 를 string 으로 지정하면 `./output` 디렉터리 아래 파일이 저장됩니다.
- 셀 너비는 텍스트 길이에 따라 자동으로 늘어나지만, 완벽하게 최적으로 설정되지는 않습니다. 따라서 엑셀의 자동 조정기능을 통해 너비를 조정해야 합니다.
- 다양한 방식으로 작성할 수 있도록 구현했습니다.

#### 1. 가장 간단한 사용법
```python
# 기본 사용법
convertor = ExcelConvertor(save_to="test").open()
convertor.header = {"이름": "이름", "휴대폰": "휴 대 폰", "가입일": "가입일"}
convertor.cell_styles = {"휴대폰": {"num_format": "@"}}
convertor.cell_comments = {"휴대폰": "- 를 제거한 후 입력해주세요."}

excel_body = list()
for x in range(1, 100):
    excel_body.append({"이름": f"홍길동{x}", "휴대폰": f"0101234567{x:02d}", "가입일": "2025-01-01"})
convertor.body = excel_body
convertor.write_sheet()
convertor.close()

# with 구문 사용법 (close 생략 가능)
with ExcelConvertor(save_to="test") as convertor:
    convertor.header = {"이름": "이름", "휴대폰": "휴 대 폰", "가입일": "가입일"}
    convertor.cell_styles = {"휴대폰": {"num_format": "@"}}
    convertor.cell_comments = {"휴대폰": "- 를 제거한 후 입력해주세요."}
    
    excel_body = list()
    for x in range(1, 100):
        excel_body.append({"이름": f"홍길동{x}", "휴대폰": f"0101234567{x:02d}", "가입일": "2025-01-01"})
    convertor.body = excel_body
    convertor.write_sheet("sheet name")
```

##### 2. 시트별로 데이터를 나누어 작성
```python
with ExcelConvertor(save_to="test") as convertor:
    convertor.header = {"이름": "이름", "휴대폰": "휴 대 폰", "가입일": "가입일"}
    convertor.cell_styles = {"휴대폰": {"num_format": "@"}}
    convertor.cell_comments = {"휴대폰": "- 를 제거한 후 입력해주세요."}
    
    excel_body = list()
    for x in range(1, 100):
        excel_body.append({"이름": f"홍길동{x}", "가입일": "2025-01-01"})
    convertor.body = excel_body
    convertor.write_sheet("by name")
    
    excel_body = list()
    for x in range(1, 100):
        excel_body.append({"휴대폰": f"1012345{x}", "가입일": "2025-01-01"})
    convertor.body = excel_body
    convertor.write_sheet("by tel")
```

#### 3. 버퍼에 저장
```python
buffer = BytesIO()
with ExcelConvertor(save_to=buffer) as convertor: 
    convertor.header = {"이름": "이름", "휴대폰": "휴 대 폰", "가입일": "가입일"}
    convertor.cell_styles = {"휴대폰": {"num_format": "@"}}
    convertor.cell_comments = {"휴대폰": "- 를 제거한 후 입력해주세요."}
    
    excel_body = list()
    for x in range(1, 100):
        excel_body.append({"이름": f"홍길동{x}", "휴대폰": f"0101234567{x:02d}", "가입일": "2025-01-01"})
    convertor.body = excel_body
    convertor.write_sheet()

# 다운로드 응답
response = HttpResponse(
    buffer.getvalue(),
    content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
)
response['Content-Disposition'] = 'attachment; filename="report.xlsx"'
return response
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "excel-convertor",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "excel, xlsx, dict, json, python",
    "author": null,
    "author_email": "Yu Jeonghoon <jeonghoon@jnghn.xyz>",
    "download_url": "https://files.pythonhosted.org/packages/a4/86/b16a868c5d3aa4cf1b4640d48631df1cb04205b0cacbf3f254c989a7c3d9/excel_convertor-1.4.3.tar.gz",
    "platform": null,
    "description": "### \uac1c\uc694\r\nxlsxwriter \ub97c \uc774\uc6a9\ud558\uc5ec \uc5d1\uc140\uc744 \ubcf4\ub2e4 \uc27d\uac8c \uc791\uc131\ud560 \uc218 \uc788\ub3c4\ub85d \ub3c4\uc640\uc8fc\ub294 \ub77c\uc774\ube0c\ub7ec\ub9ac\uc785\ub2c8\ub2e4.\r\n\ud5e4\ub354 \ubc0f \uc2a4\ud0c0\uc77c \ub4f1\uc744 \uac04\ub2e8\ud788 \uc9c0\uc815\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\r\n\r\n### \uc124\uce58\r\n```bash\r\npip install xlsx-creator\r\n```\r\n\r\n### \uc0ac\uc6a9\ubc95\r\n- header \uc758 key \ub97c \uae30\uc900\uc73c\ub85c \ub370\uc774\ud130\ub97c \uac00\uacf5\ud558\uc5ec \uc5d1\uc140\ub85c \uc800\uc7a5\ud569\ub2c8\ub2e4. `save_to` \ub97c string \uc73c\ub85c \uc9c0\uc815\ud558\uba74 `./output` \ub514\ub809\ud130\ub9ac \uc544\ub798 \ud30c\uc77c\uc774 \uc800\uc7a5\ub429\ub2c8\ub2e4.\r\n- \uc140 \ub108\ube44\ub294 \ud14d\uc2a4\ud2b8 \uae38\uc774\uc5d0 \ub530\ub77c \uc790\ub3d9\uc73c\ub85c \ub298\uc5b4\ub098\uc9c0\ub9cc, \uc644\ubcbd\ud558\uac8c \ucd5c\uc801\uc73c\ub85c \uc124\uc815\ub418\uc9c0\ub294 \uc54a\uc2b5\ub2c8\ub2e4. \ub530\ub77c\uc11c \uc5d1\uc140\uc758 \uc790\ub3d9 \uc870\uc815\uae30\ub2a5\uc744 \ud1b5\ud574 \ub108\ube44\ub97c \uc870\uc815\ud574\uc57c \ud569\ub2c8\ub2e4.\r\n- \ub2e4\uc591\ud55c \ubc29\uc2dd\uc73c\ub85c \uc791\uc131\ud560 \uc218 \uc788\ub3c4\ub85d \uad6c\ud604\ud588\uc2b5\ub2c8\ub2e4.\r\n\r\n#### 1. \uac00\uc7a5 \uac04\ub2e8\ud55c \uc0ac\uc6a9\ubc95\r\n```python\r\n# \uae30\ubcf8 \uc0ac\uc6a9\ubc95\r\nconvertor = ExcelConvertor(save_to=\"test\").open()\r\nconvertor.header = {\"\uc774\ub984\": \"\uc774\ub984\", \"\ud734\ub300\ud3f0\": \"\ud734 \ub300 \ud3f0\", \"\uac00\uc785\uc77c\": \"\uac00\uc785\uc77c\"}\r\nconvertor.cell_styles = {\"\ud734\ub300\ud3f0\": {\"num_format\": \"@\"}}\r\nconvertor.cell_comments = {\"\ud734\ub300\ud3f0\": \"- \ub97c \uc81c\uac70\ud55c \ud6c4 \uc785\ub825\ud574\uc8fc\uc138\uc694.\"}\r\n\r\nexcel_body = list()\r\nfor x in range(1, 100):\r\n    excel_body.append({\"\uc774\ub984\": f\"\ud64d\uae38\ub3d9{x}\", \"\ud734\ub300\ud3f0\": f\"0101234567{x:02d}\", \"\uac00\uc785\uc77c\": \"2025-01-01\"})\r\nconvertor.body = excel_body\r\nconvertor.write_sheet()\r\nconvertor.close()\r\n\r\n# with \uad6c\ubb38 \uc0ac\uc6a9\ubc95 (close \uc0dd\ub7b5 \uac00\ub2a5)\r\nwith ExcelConvertor(save_to=\"test\") as convertor:\r\n    convertor.header = {\"\uc774\ub984\": \"\uc774\ub984\", \"\ud734\ub300\ud3f0\": \"\ud734 \ub300 \ud3f0\", \"\uac00\uc785\uc77c\": \"\uac00\uc785\uc77c\"}\r\n    convertor.cell_styles = {\"\ud734\ub300\ud3f0\": {\"num_format\": \"@\"}}\r\n    convertor.cell_comments = {\"\ud734\ub300\ud3f0\": \"- \ub97c \uc81c\uac70\ud55c \ud6c4 \uc785\ub825\ud574\uc8fc\uc138\uc694.\"}\r\n    \r\n    excel_body = list()\r\n    for x in range(1, 100):\r\n        excel_body.append({\"\uc774\ub984\": f\"\ud64d\uae38\ub3d9{x}\", \"\ud734\ub300\ud3f0\": f\"0101234567{x:02d}\", \"\uac00\uc785\uc77c\": \"2025-01-01\"})\r\n    convertor.body = excel_body\r\n    convertor.write_sheet(\"sheet name\")\r\n```\r\n\r\n##### 2. \uc2dc\ud2b8\ubcc4\ub85c \ub370\uc774\ud130\ub97c \ub098\ub204\uc5b4 \uc791\uc131\r\n```python\r\nwith ExcelConvertor(save_to=\"test\") as convertor:\r\n    convertor.header = {\"\uc774\ub984\": \"\uc774\ub984\", \"\ud734\ub300\ud3f0\": \"\ud734 \ub300 \ud3f0\", \"\uac00\uc785\uc77c\": \"\uac00\uc785\uc77c\"}\r\n    convertor.cell_styles = {\"\ud734\ub300\ud3f0\": {\"num_format\": \"@\"}}\r\n    convertor.cell_comments = {\"\ud734\ub300\ud3f0\": \"- \ub97c \uc81c\uac70\ud55c \ud6c4 \uc785\ub825\ud574\uc8fc\uc138\uc694.\"}\r\n    \r\n    excel_body = list()\r\n    for x in range(1, 100):\r\n        excel_body.append({\"\uc774\ub984\": f\"\ud64d\uae38\ub3d9{x}\", \"\uac00\uc785\uc77c\": \"2025-01-01\"})\r\n    convertor.body = excel_body\r\n    convertor.write_sheet(\"by name\")\r\n    \r\n    excel_body = list()\r\n    for x in range(1, 100):\r\n        excel_body.append({\"\ud734\ub300\ud3f0\": f\"1012345{x}\", \"\uac00\uc785\uc77c\": \"2025-01-01\"})\r\n    convertor.body = excel_body\r\n    convertor.write_sheet(\"by tel\")\r\n```\r\n\r\n#### 3. \ubc84\ud37c\uc5d0 \uc800\uc7a5\r\n```python\r\nbuffer = BytesIO()\r\nwith ExcelConvertor(save_to=buffer) as convertor: \r\n    convertor.header = {\"\uc774\ub984\": \"\uc774\ub984\", \"\ud734\ub300\ud3f0\": \"\ud734 \ub300 \ud3f0\", \"\uac00\uc785\uc77c\": \"\uac00\uc785\uc77c\"}\r\n    convertor.cell_styles = {\"\ud734\ub300\ud3f0\": {\"num_format\": \"@\"}}\r\n    convertor.cell_comments = {\"\ud734\ub300\ud3f0\": \"- \ub97c \uc81c\uac70\ud55c \ud6c4 \uc785\ub825\ud574\uc8fc\uc138\uc694.\"}\r\n    \r\n    excel_body = list()\r\n    for x in range(1, 100):\r\n        excel_body.append({\"\uc774\ub984\": f\"\ud64d\uae38\ub3d9{x}\", \"\ud734\ub300\ud3f0\": f\"0101234567{x:02d}\", \"\uac00\uc785\uc77c\": \"2025-01-01\"})\r\n    convertor.body = excel_body\r\n    convertor.write_sheet()\r\n\r\n# \ub2e4\uc6b4\ub85c\ub4dc \uc751\ub2f5\r\nresponse = HttpResponse(\r\n    buffer.getvalue(),\r\n    content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\r\n)\r\nresponse['Content-Disposition'] = 'attachment; filename=\"report.xlsx\"'\r\nreturn response\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT License\r\n        \r\n        Copyright (c) 2025 Your Name\r\n        \r\n        Permission is hereby granted, free of charge, to any person obtaining a copy\r\n        of this software and associated documentation files (the \"Software\"), to deal\r\n        in the Software without restriction, including without limitation the rights\r\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n        copies of the Software, and to permit persons to whom the Software is\r\n        furnished to do so, subject to the following conditions:\r\n        \r\n        The above copyright notice and this permission notice shall be included in\r\n        all copies or substantial portions of the Software.\r\n        \r\n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n        THE SOFTWARE.\r\n        ",
    "summary": "\uc5d1\uc140 \uc0dd\uc131\uae30 from dictionary",
    "version": "1.4.3",
    "project_urls": {
        "Bug Tracker": "https://github.com/moning02004/excel-convertor/issues",
        "Homepage": "https://github.com/moning02004/excel-convertor"
    },
    "split_keywords": [
        "excel",
        " xlsx",
        " dict",
        " json",
        " python"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fdf84f7e529567dcb0f119f6d41d87b014e89bf6275e1ecd80f6eaba9f1143c3",
                "md5": "605d6e043b35d821b4fbd5ac0b815e90",
                "sha256": "2054dd5dc7e5d0a21be1e1ec0575e38722853cab6f23ceef8849b92a5b5c0901"
            },
            "downloads": -1,
            "filename": "excel_convertor-1.4.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "605d6e043b35d821b4fbd5ac0b815e90",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7178,
            "upload_time": "2025-10-22T08:30:40",
            "upload_time_iso_8601": "2025-10-22T08:30:40.127572Z",
            "url": "https://files.pythonhosted.org/packages/fd/f8/4f7e529567dcb0f119f6d41d87b014e89bf6275e1ecd80f6eaba9f1143c3/excel_convertor-1.4.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a486b16a868c5d3aa4cf1b4640d48631df1cb04205b0cacbf3f254c989a7c3d9",
                "md5": "7f27ddd27e58339b8d8181a9a85cf534",
                "sha256": "3c745bdbcefdade9e586a3ee2ad1e87ca97c370d1b23eb01d5af468181d065ba"
            },
            "downloads": -1,
            "filename": "excel_convertor-1.4.3.tar.gz",
            "has_sig": false,
            "md5_digest": "7f27ddd27e58339b8d8181a9a85cf534",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 6792,
            "upload_time": "2025-10-22T08:30:42",
            "upload_time_iso_8601": "2025-10-22T08:30:42.225442Z",
            "url": "https://files.pythonhosted.org/packages/a4/86/b16a868c5d3aa4cf1b4640d48631df1cb04205b0cacbf3f254c989a7c3d9/excel_convertor-1.4.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-22 08:30:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "moning02004",
    "github_project": "excel-convertor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "excel-convertor"
}
        
Elapsed time: 4.63783s