Dash & XLwings. Attempting to pre-load Excel before Dash callback to save load time.
还没有人认领这个 Issue。
评估
调研方向
The issue names the Dash finalFxn callback and its xlwings App setup, but no repository file or test. Start by tracing the callback registration and per-client Excel connection behavior described in the example. Done means establishing whether the requested preload and callback lifecycle can be supported without converting the workbook or VBA.
由索引模型根据 Issue 内容生成。
描述
Windows 10 Enterprise for local. Windows Server 2022 Standard for the server
3.10 Python, Microsoft 365 Apps for enterprise, 0.28.7 xlwings
I have a web interface project that is using a connection between XLwings and Dash. The Excel file is large and takes about 15 seconds to load, while the calc only takes 5 seconds. Since it is setup to run over the web, each client will have their own instance of Excel. XLwings has a way to handle this.
Currently the setup is that once the user enters their setup and clicks submit, only then does the connection start.
If this was normal python, I could just start the connection earlier. However, with Dash the only connection between the layout, and the function definition is the Dash callback.
The goal is to load the Excel file as soon as the page is loaded, while that is happening the user would enter their parameters, the time that takes to load would be saved and the result return time would be shortened by that time.
*
I would like to use a chained callback. The first callback would load on page load with the xlWings connection. 'prevent_initial_call' would be false.
The final callback I have setup the 'prevent_initial_call' to True because I don't want this to run until they hit submit.
*
If I setup the connection as a variable or function, it doesn't look like you can pass these through the callback in anyway.
Project requirements are that the Excel and its VBA not be converted to Python/Dash.
Possible to launch one, or a few, Excels' on launch, and have XLwings grab the PID somehow? Would another Excel extension handle this? I know we're not supposed to use 'Global' variables, but that might fit this particular need.
Above this code part is the layout setup for Dash
@callback(
#many Output and Inputs. Removed most for clarity.
Output(component_id='table', component_property='data'),
Input(component_id='yearSlider', component_property='value'),
)
def finalFxn(
#many parameters. Removed most for clarity.
parameter1,
parameter2
):
with xw.App(visible=True) as app:
wb = app.books.open(r"C:\Users\mike\Downloads\modified3-31.xlsm")
#logic
# excel cells = parameters from web
#logic
# parameters to web = excel
return results, graph, etc.
- 主要语言
- HTML
- 星标
- 758
- 派生
- 1.6k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
plotly/datasets 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 42/100
-
难度 3/5 1-2 天 新手友好度 45/100
-
难度 2/5 1-3 小时 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 25/100
-
难度 1/5 1 小时以内 新手友好度 25/100
相似的 Issue
-
bug file-compat priority: high
难度 2/5 1-3 小时 新手友好度 76/100
storytold/photocraft#11330 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100
bretterer/home-assistant-rivian#335 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
mampfes/hacs_waste_collection_schedule#8114 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 69/100
UKGovernmentBEIS/inspect_ai#6321 ·
维护者通常 1 天内回复
-
enhancement help wanted
难度 2/5 1-3 小时 新手友好度 82/100
samiromer2/Ruby-Consent-Portal#28 ·
维护者通常 1 天内回复