django-excel-storage


Namedjango-excel-storage JSON
Version 2.0.11 PyPI version JSON
download
home_pagehttps://github.com/django-xxx/django-excel-storage
SummaryDjango Excel Storage
upload_time2023-07-19 07:51:13
maintainer
docs_urlNone
authorHackathon
requires_python
license
keywords django-excel-storage
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-excel-storage
Django Excel Storage

## Installation

    pip install django-excel-storage


## Usage

    from django_excel_storage import ExcelStorage

    def excelfunc():
        objs = SomeModel.objects.all()
        fpath = ExcelStorage(objs).save()
        
        
or

    from django_excel_storage import ExcelStorage

    def excelfunc():
        data = [
            {
                'Column 1': 1,
                'Column 2': 2,
            },
            {
                'Column 1': 3,
                'Column 2': 4,
            }
        ]
        fpath = ExcelStorage(data, 'my_data', font='name SimSum').save()


or

    from django_excel_storage import ExcelStorage

    def excelfunc():
        data = [
            ['Column 1', 'Column 2'],
            [1, 2],
            [3, 4]
        ]
        fpath = ExcelStorage(data, 'my_data', font='name SimSum').save()


or

    from django_excel_storage import ExcelStorage

    def excelfunc():
        data = [
            ['Column 1', 'Column 2'],
            [1, [2, 3]],
            [3, 4]
        ]
        fpath = ExcelStorage(data, 'my_data', font='name SimSum', merge_type='row_merge').save()


or

    from django_excel_storage import ExcelStorage

    def excelfunc():
        headers = ['Column 1', 'Column 2', 'Column 3', 'Column 4', 'Column 5']
        data = [['Value 1', [['Value 2 Row 1', [['Value 3', 'Value 4', [['Value 5']]]]], ['Value 2 Row 2', [['Value 3 Row 1', 'Value 4 Row 1', [['Value 5 Row 1']]], ['Value 3 Row 2', 'Value 4 Row 2', [['Value 5 Row 2']]]]]]]]
        fpath = ExcelStorage(data, 'my_data', font='name SimSum', merge_type='list_row_merge', headers=headers)


or

    from django_excel_storage import ExcelStorage

    def excelfunc():
        headers = ['Column 1', 'Column 2', 'Column 3', 'Column 4', 'Column 5']
        mapping = {
            'field_key': 'Column 1',
            'data_key': 'Children 1',
            'next': {
                'field_key': 'Column 2',
                'data_key': 'Children 2',
                'next': {
                    'field_key': ['Column 3', 'Column 4'],
                    'data_key': 'Children 3',
                    'next': {
                        'field_key': 'Column 5',
                    }
                }
            }
        }
        data = [{
            'Column 1': 'Value 1',
            'Column 11': 'Value 11',
            'Children 1': [{
                'Column 2': 'Value 2 Row 1',
                'Column 22': 'Value 22 Row 1',
                'Children 2': [{
                    'Column 3': 'Value 3',
                    'Column 4': 'Value 4',
                    'Children 3': {
                        'Column 5': 'Value 5',
                    }
                }]
            }, {
                'Column 2': 'Value 2 Row 2',
                'Column 22': 'Value 22 Row 2',
                'Children 2': [{
                    'Column 3': 'Value 3 Row 1',
                    'Column 4': 'Value 4 Row 1',
                    'Children 3': {
                        'Column 5': 'Value 5 Row 1',
                    }
                }, {
                    'Column 3': 'Value 3 Row 2',
                    'Column 4': 'Value 4 Row 2',
                    'Children 3': {
                        'Column 5': 'Value 5 Row 2',
                    }
                }]
            }]
        }]
        fpath = ExcelStorage(data, 'my_data', font='name SimSum', merge_type='dict_row_merge', mapping=mapping, headers=headers)


## Params

  * font='name SimSum'
    * Set Font as SimSum(宋体)
  * force_csv=True
    * CSV Format? True for Yes, False for No, Default is False


## CSV

  ```python
  datas = [
      [u'中文', ]
  ]
  ```

|                 | Win Excel 2013 | Mac Excel 2011 | Mac Excel 2016 | Mac Numbers |
| --------------- | :------------: | :------------: | :------------: | :---------: |
| UTF8            | Messy          | Messy          | Messy          | Normal      |
| GB18030         | Normal         | Normal         | Normal         | Messy       |
| UTF8 + BOM_UTF8 | Normal         | Messy          | Normal         | Normal      |
| UTF16LE + BOM   |                |                |                |             |

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/django-xxx/django-excel-storage",
    "name": "django-excel-storage",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "django-excel-storage",
    "author": "Hackathon",
    "author_email": "kimi.huang@brightcells.com",
    "download_url": "https://files.pythonhosted.org/packages/98/de/5dff523894463cbff06a3fd853d8d41a49483cc5552c889b207d6c0bdb8d/django-excel-storage-2.0.11.tar.gz",
    "platform": null,
    "description": "# django-excel-storage\nDjango Excel Storage\n\n## Installation\n\n    pip install django-excel-storage\n\n\n## Usage\n\n    from django_excel_storage import ExcelStorage\n\n    def excelfunc():\n        objs = SomeModel.objects.all()\n        fpath = ExcelStorage(objs).save()\n        \n        \nor\n\n    from django_excel_storage import ExcelStorage\n\n    def excelfunc():\n        data = [\n            {\n                'Column 1': 1,\n                'Column 2': 2,\n            },\n            {\n                'Column 1': 3,\n                'Column 2': 4,\n            }\n        ]\n        fpath = ExcelStorage(data, 'my_data', font='name SimSum').save()\n\n\nor\n\n    from django_excel_storage import ExcelStorage\n\n    def excelfunc():\n        data = [\n            ['Column 1', 'Column 2'],\n            [1, 2],\n            [3, 4]\n        ]\n        fpath = ExcelStorage(data, 'my_data', font='name SimSum').save()\n\n\nor\n\n    from django_excel_storage import ExcelStorage\n\n    def excelfunc():\n        data = [\n            ['Column 1', 'Column 2'],\n            [1, [2, 3]],\n            [3, 4]\n        ]\n        fpath = ExcelStorage(data, 'my_data', font='name SimSum', merge_type='row_merge').save()\n\n\nor\n\n    from django_excel_storage import ExcelStorage\n\n    def excelfunc():\n        headers = ['Column 1', 'Column 2', 'Column 3', 'Column 4', 'Column 5']\n        data = [['Value 1', [['Value 2 Row 1', [['Value 3', 'Value 4', [['Value 5']]]]], ['Value 2 Row 2', [['Value 3 Row 1', 'Value 4 Row 1', [['Value 5 Row 1']]], ['Value 3 Row 2', 'Value 4 Row 2', [['Value 5 Row 2']]]]]]]]\n        fpath = ExcelStorage(data, 'my_data', font='name SimSum', merge_type='list_row_merge', headers=headers)\n\n\nor\n\n    from django_excel_storage import ExcelStorage\n\n    def excelfunc():\n        headers = ['Column 1', 'Column 2', 'Column 3', 'Column 4', 'Column 5']\n        mapping = {\n            'field_key': 'Column 1',\n            'data_key': 'Children 1',\n            'next': {\n                'field_key': 'Column 2',\n                'data_key': 'Children 2',\n                'next': {\n                    'field_key': ['Column 3', 'Column 4'],\n                    'data_key': 'Children 3',\n                    'next': {\n                        'field_key': 'Column 5',\n                    }\n                }\n            }\n        }\n        data = [{\n            'Column 1': 'Value 1',\n            'Column 11': 'Value 11',\n            'Children 1': [{\n                'Column 2': 'Value 2 Row 1',\n                'Column 22': 'Value 22 Row 1',\n                'Children 2': [{\n                    'Column 3': 'Value 3',\n                    'Column 4': 'Value 4',\n                    'Children 3': {\n                        'Column 5': 'Value 5',\n                    }\n                }]\n            }, {\n                'Column 2': 'Value 2 Row 2',\n                'Column 22': 'Value 22 Row 2',\n                'Children 2': [{\n                    'Column 3': 'Value 3 Row 1',\n                    'Column 4': 'Value 4 Row 1',\n                    'Children 3': {\n                        'Column 5': 'Value 5 Row 1',\n                    }\n                }, {\n                    'Column 3': 'Value 3 Row 2',\n                    'Column 4': 'Value 4 Row 2',\n                    'Children 3': {\n                        'Column 5': 'Value 5 Row 2',\n                    }\n                }]\n            }]\n        }]\n        fpath = ExcelStorage(data, 'my_data', font='name SimSum', merge_type='dict_row_merge', mapping=mapping, headers=headers)\n\n\n## Params\n\n  * font='name SimSum'\n    * Set Font as SimSum(\u5b8b\u4f53)\n  * force_csv=True\n    * CSV Format? True for Yes, False for No, Default is False\n\n\n## CSV\n\n  ```python\n  datas = [\n      [u'\u4e2d\u6587', ]\n  ]\n  ```\n\n|                 | Win Excel 2013 | Mac Excel 2011 | Mac Excel 2016 | Mac Numbers |\n| --------------- | :------------: | :------------: | :------------: | :---------: |\n| UTF8            | Messy          | Messy          | Messy          | Normal      |\n| GB18030         | Normal         | Normal         | Normal         | Messy       |\n| UTF8 + BOM_UTF8 | Normal         | Messy          | Normal         | Normal      |\n| UTF16LE + BOM   |                |                |                |             |\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Django Excel Storage",
    "version": "2.0.11",
    "project_urls": {
        "Homepage": "https://github.com/django-xxx/django-excel-storage"
    },
    "split_keywords": [
        "django-excel-storage"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "db34914e9452578377ba7bce901f8ef88868e94e77facf711a00c28a6f317a9d",
                "md5": "016f495cae68cece1af47f9ca468dca4",
                "sha256": "89a1da29bf609660f70eb412441babb6cd0da79c58cf00e20311ed1b722cff4f"
            },
            "downloads": -1,
            "filename": "django_excel_storage-2.0.11-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "016f495cae68cece1af47f9ca468dca4",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 4516,
            "upload_time": "2023-07-19T07:51:11",
            "upload_time_iso_8601": "2023-07-19T07:51:11.966561Z",
            "url": "https://files.pythonhosted.org/packages/db/34/914e9452578377ba7bce901f8ef88868e94e77facf711a00c28a6f317a9d/django_excel_storage-2.0.11-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "98de5dff523894463cbff06a3fd853d8d41a49483cc5552c889b207d6c0bdb8d",
                "md5": "20c4339af0df3d9f063485452e20f35a",
                "sha256": "04905499345c73995009af898d47f38efd89e156ecfc0a513f64b032fcd35deb"
            },
            "downloads": -1,
            "filename": "django-excel-storage-2.0.11.tar.gz",
            "has_sig": false,
            "md5_digest": "20c4339af0df3d9f063485452e20f35a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4875,
            "upload_time": "2023-07-19T07:51:13",
            "upload_time_iso_8601": "2023-07-19T07:51:13.422584Z",
            "url": "https://files.pythonhosted.org/packages/98/de/5dff523894463cbff06a3fd853d8d41a49483cc5552c889b207d6c0bdb8d/django-excel-storage-2.0.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-19 07:51:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "django-xxx",
    "github_project": "django-excel-storage",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "django-excel-storage"
}
        
Elapsed time: 0.25861s