Name | xlfly JSON |
Version |
0.9.0
JSON |
| download |
home_page | None |
Summary | None |
upload_time | 2024-11-07 05:49:45 |
maintainer | None |
docs_url | None |
author | Your Name |
requires_python | >=3.9 |
license | None |
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.
### Picture Run
When selecting a picture, click Run Python, the app's run_pic() function will be run. To customize, in the
pre-cmd cell in 'xlfly' sheet, put the following inside.
```python
def run_pic(pic):
print("new method")
self.run_pic = run_pic
```
### 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/22/59/93df702d1edf37a84d3d0846510fab3605606228ce77fbcd9179504ffba1/xlfly-0.9.0.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### Picture Run\n\nWhen selecting a picture, click Run Python, the app's run_pic() function will be run. To customize, in the \npre-cmd cell in 'xlfly' sheet, put the following inside. \n\n```python\ndef run_pic(pic):\n print(\"new method\")\n\nself.run_pic = run_pic\n```\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.9.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "47c5e93807e8054dab5bf39eed53433d161d52d9671a90797f2ac272495f5aca",
"md5": "020f2c44e4a275e3249463b0ec2dd0b7",
"sha256": "72cb99280f6a71bd610897c5b33a5f078bb71095b8154b96beda637421b209ad"
},
"downloads": -1,
"filename": "xlfly-0.9.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "020f2c44e4a275e3249463b0ec2dd0b7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 85506,
"upload_time": "2024-11-07T05:49:43",
"upload_time_iso_8601": "2024-11-07T05:49:43.634609Z",
"url": "https://files.pythonhosted.org/packages/47/c5/e93807e8054dab5bf39eed53433d161d52d9671a90797f2ac272495f5aca/xlfly-0.9.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "225993df702d1edf37a84d3d0846510fab3605606228ce77fbcd9179504ffba1",
"md5": "7a17f37b27ea9e490e9cefe6fb2af2ac",
"sha256": "acc47da26867168418a1879fb4e8828e438a6b219a90c836350f271e300ed722"
},
"downloads": -1,
"filename": "xlfly-0.9.0.tar.gz",
"has_sig": false,
"md5_digest": "7a17f37b27ea9e490e9cefe6fb2af2ac",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 85490,
"upload_time": "2024-11-07T05:49:45",
"upload_time_iso_8601": "2024-11-07T05:49:45.681855Z",
"url": "https://files.pythonhosted.org/packages/22/59/93df702d1edf37a84d3d0846510fab3605606228ce77fbcd9179504ffba1/xlfly-0.9.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-07 05:49:45",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "xlfly"
}