xlfly


Namexlfly JSON
Version 0.8.2 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2024-10-18 05:32:55
maintainerNone
docs_urlNone
authorYour Name
requires_python>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # xlfly - Excel Python hack for non-programmers

How to make non-programmers using python to hack Excel? Jupyter, python IDE, VS Code is not an option. With xlfly, you can deploy user friendly hack tool that makes the installation a breeze, usage intuitive, and your development stay in your comfort zone like VS Code.

Note: the author is from manufacturing industry where Excel is heavily used to do daily data processing and customer data report. Most people aournd me knows nothing about python, but craving for a handy tool. 

## Usage for non-programmers

### Install

If you are installed multiple pythons in your windows platform, you can use:

* `py -3.12 -m pip config set global.index-url https://pypi.org/simple`
* `py -3.12 -m pip install xlfly`
* `py -3.12 -m xlfly.scripts --init -t path\to\template\folder`

where `py` is the python launcher in Windows to specify the version to use

### Usage

Fire up an Excel, write python commands in a cell or comments, select it, click "Run Python" to execute!

<img src="doc/xlfly_demo.gif" width="500">

## Developers

### xlfly config page

To condition your python environment, you shall add a "xlfly" sheet to specify the conditions. You can add it with "File -> Add Config Page" in the menu. This sheet has:

1. **script_path**: the path to inclue your own module. 
2. **pre_cmd**: the command to run before executing user's command. I usually put `import` commands here
3. **requirements**: python packages to install for this Excel. It follows pip's requirements.txt syntax. Thus you can write `pandas>=2.0.0`.

### PythonPath

When run python, both `current workbook` and `script_path` setting from setting page will be added to pythonpath. 

Current workbook's path module will be loaded first. Such behavior is useful when you need to develop a script and then deploy to a shared server.

### Magic commands

* self.run_cell()

    Run multiple cells with a command

    Example:`self.run_cell(sht["A1:A5"])`

* xw.Range.to_link()

    Convert the range to link texts values. It is used for cases where you want to preserve the link to update the data in the future. Useful if you got data from another Excel file, and that file changes.


### Debug

To debug the scripts in Excel, run the menu: tools > create debug script. There will be a debug.py file to the same folder as current Excel file. You can start from there to debug

## Templates

How to deploy Excel templates in a corporate environment? I think a shared path to store scripts, while Excel file download to user is easiest.

Specify a template root path (most likely a shared path) to have all subfolders as options in the "templates > choose template" menu. Once selected, the main() function in the __init__.py file in that subfolder will be executed to initialize the template.

UDF VBA functions - sometimes users wants to have functions they can directly use in the Excel cells. In that case, it is recommended to write *.xlam files with UDF inside, then move it to the user addin directory. Such copy file over operation can be done with xlfly.move_addin() function


### default folder

Within template folder, you can add "default" subfolder to pythonpath by default, and the default.py file will be imported automatically. This is useful if you want to create Excel use cases where user can work on an empty Excel file without installing anything or making changes to Excel file

When installing xlfly, the `template_root_folder/default/__init__:setup()` will be executed. 

for the default.py, put `run_callback` function to be called every time a user click the `run python` button

## Others

Icon is from [Icon Finder](https://www.iconfinder.com/icons/2785363/blockchain_wings_icon) by Monsieur Steven Ankri.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "xlfly",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/85/b0/7beeaf9cdd2a6b79a7fab65ad1916d1edb47dedb8f4e4e6dc3e8fc4a8a75/xlfly-0.8.2.tar.gz",
    "platform": null,
    "description": "# xlfly - Excel Python hack for non-programmers\n\nHow to make non-programmers using python to hack Excel? Jupyter, python IDE, VS Code is not an option. With xlfly, you can deploy user friendly hack tool that makes the installation a breeze, usage intuitive, and your development stay in your comfort zone like VS Code.\n\nNote: the author is from manufacturing industry where Excel is heavily used to do daily data processing and customer data report. Most people aournd me knows nothing about python, but craving for a handy tool. \n\n## Usage for non-programmers\n\n### Install\n\nIf you are installed multiple pythons in your windows platform, you can use:\n\n* `py -3.12 -m pip config set global.index-url https://pypi.org/simple`\n* `py -3.12 -m pip install xlfly`\n* `py -3.12 -m xlfly.scripts --init -t path\\to\\template\\folder`\n\nwhere `py` is the python launcher in Windows to specify the version to use\n\n### Usage\n\nFire up an Excel, write python commands in a cell or comments, select it, click \"Run Python\" to execute!\n\n<img src=\"doc/xlfly_demo.gif\" width=\"500\">\n\n## Developers\n\n### xlfly config page\n\nTo condition your python environment, you shall add a \"xlfly\" sheet to specify the conditions. You can add it with \"File -> Add Config Page\" in the menu. This sheet has:\n\n1. **script_path**: the path to inclue your own module. \n2. **pre_cmd**: the command to run before executing user's command. I usually put `import` commands here\n3. **requirements**: python packages to install for this Excel. It follows pip's requirements.txt syntax. Thus you can write `pandas>=2.0.0`.\n\n### PythonPath\n\nWhen run python, both `current workbook` and `script_path` setting from setting page will be added to pythonpath. \n\nCurrent workbook's path module will be loaded first. Such behavior is useful when you need to develop a script and then deploy to a shared server.\n\n### Magic commands\n\n* self.run_cell()\n\n    Run multiple cells with a command\n\n    Example:`self.run_cell(sht[\"A1:A5\"])`\n\n* xw.Range.to_link()\n\n    Convert the range to link texts values. It is used for cases where you want to preserve the link to update the data in the future. Useful if you got data from another Excel file, and that file changes.\n\n\n### Debug\n\nTo debug the scripts in Excel, run the menu: tools > create debug script. There will be a debug.py file to the same folder as current Excel file. You can start from there to debug\n\n## Templates\n\nHow to deploy Excel templates in a corporate environment? I think a shared path to store scripts, while Excel file download to user is easiest.\n\nSpecify a template root path (most likely a shared path) to have all subfolders as options in the \"templates > choose template\" menu. Once selected, the main() function in the __init__.py file in that subfolder will be executed to initialize the template.\n\nUDF VBA functions - sometimes users wants to have functions they can directly use in the Excel cells. In that case, it is recommended to write *.xlam files with UDF inside, then move it to the user addin directory. Such copy file over operation can be done with xlfly.move_addin() function\n\n\n### default folder\n\nWithin template folder, you can add \"default\" subfolder to pythonpath by default, and the default.py file will be imported automatically. This is useful if you want to create Excel use cases where user can work on an empty Excel file without installing anything or making changes to Excel file\n\nWhen installing xlfly, the `template_root_folder/default/__init__:setup()` will be executed. \n\nfor the default.py, put `run_callback` function to be called every time a user click the `run python` button\n\n## Others\n\nIcon is from [Icon Finder](https://www.iconfinder.com/icons/2785363/blockchain_wings_icon) by Monsieur Steven Ankri.",
    "bugtrack_url": null,
    "license": null,
    "summary": null,
    "version": "0.8.2",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "af3b5d81a0940db1bd70fb24bd4fc3f7c31272954d13756b089c831a480b211c",
                "md5": "effaebb649954a35085b8566bf33fd45",
                "sha256": "a305922ffbb5ff32ff9b8f6b6691107948dff7b86da1cbc1ae011fd335d22521"
            },
            "downloads": -1,
            "filename": "xlfly-0.8.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "effaebb649954a35085b8566bf33fd45",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 85130,
            "upload_time": "2024-10-18T05:32:53",
            "upload_time_iso_8601": "2024-10-18T05:32:53.849598Z",
            "url": "https://files.pythonhosted.org/packages/af/3b/5d81a0940db1bd70fb24bd4fc3f7c31272954d13756b089c831a480b211c/xlfly-0.8.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "85b07beeaf9cdd2a6b79a7fab65ad1916d1edb47dedb8f4e4e6dc3e8fc4a8a75",
                "md5": "1bfedffba05dd7ab0dfa9556c3cf2bba",
                "sha256": "0ca71160b2840634cfc5b34dfa241b09ef062db757aafaa58b0365b545881750"
            },
            "downloads": -1,
            "filename": "xlfly-0.8.2.tar.gz",
            "has_sig": false,
            "md5_digest": "1bfedffba05dd7ab0dfa9556c3cf2bba",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 84909,
            "upload_time": "2024-10-18T05:32:55",
            "upload_time_iso_8601": "2024-10-18T05:32:55.381552Z",
            "url": "https://files.pythonhosted.org/packages/85/b0/7beeaf9cdd2a6b79a7fab65ad1916d1edb47dedb8f4e4e6dc3e8fc4a8a75/xlfly-0.8.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-18 05:32:55",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "xlfly"
}
        
Elapsed time: 0.38525s