Forum Discussion
Making Python-in-Excel worth it
I feel like Python-in-Excel has huge promise. Embedding a Seaborn correlation matrix in an analysis sheet with a couple lines of readable code? Keeping multiple dimensions of data in one cell efficiently? Making models that involve recursion and iteration without all the workarounds of LET/LAMBDA? Yes please!!
I've messed around with it a lot but my experience has mostly been negative and from reading comments it sounds like a lot of others have had bad experiences too. A local version that was unlimited for free would be ideal of course. But I'm going to assume for a minute that isn't possible for business reasons.
Most of my frustrations relate to these three things. So maybe if we could get these it would be worth it to use?
- A way to track usage and buy more credits so we don't get stuck with #BLOCKED! with no recourse
- Improve the xl() function so it works with variables inside it instead of just literals. e.g. foo = "B4" ; bar = xl(foo) currently doesn't work but it should.
- The error messages need to always tell you what line number the error is in
I'm curious if other folks have tried it and agree or disagree with this wish list.
3 Replies
- EricAshtonCopper Contributor
Thanks Owen very helpful! I'll check out the video. Fingers crossed on that not-too-distant future stuff!
I do have the premium Python subscription. But there was no way to track usage and I still got blocked in April right before the eSports competition I planned to use it for and customer service couldn't help me at all (the personal help sent me to the enterprise help and vice versa).
- flexyourdataIron Contributor
Something occurred to me about the #BLOCKED! message. This isn't typically used for running out of credits. It's used for when the service is unavailable to your account. Do you have more than one Excel account where one has the subscription and one doesn't? IF you were logged into the wrong account, that might be the reason.
Note that even if you have Excel signed in to the premium-owning account, if the file you're working on is in the non-premium-owning account's onedrive, then it will not use the premium Python in Excel.
- flexyourdataIron Contributor
Hi Eric
With regards to your 3 points:
- There's really only one way to speed up and that's to buy the premium subscription of Python in Excel. You've no doubt found that the standard speed can be frustrating if you're working with it a lot.
- The xl() method is not a Python function. Strictly speaking it's a Macro that is resolved on the client-side before sending data to the runtime. So, there is no way for the argument inside that function to be a Python variable, because at the time it's resolved, the Python runtime can't see it. Strongly recommend you view this video to learn a lot about how to use xl() (as well as other things):
https://youtu.be/8cbdCISh4qg?si=RQqV-VXUbOxyztzE
Specifically, see the comment I left in that thread and time 24:20 for a description of why the xl() method is a macro and not a function. - I agree with you and while I can't speak for the product team, I suppose better debugging in the Python Editor will be forthcoming in the not-too-distant future.
I've also sent you a message and a connection request on LinkedIn.
Cheers
Owen