+ 29

Is possible (and a good practice) to use Python to develop a macro in Excel?

Python in Excel?

30th Apr 2018, 6:26 PM
FBFJ
FBFJ - avatar
23 ответов
+ 29
That should do the trick ;) https://www.xlwings.org
30th Apr 2018, 7:35 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 20
nothing possible guys
2nd May 2018, 1:02 AM
Nina Hendra Putri
Nina Hendra Putri - avatar
+ 13
I don't mind mangling the data in Excel, as it is very efficient in translating the regular user experience into organized and clean data. You can restrict it in many ways which is especially important in a complex organization or corporation environment. It is your input() -- just for everyone :) Finally, it can output a nice .csv which is easily converted to a DataFrame. So it takes a loooooot of data cleaning from you, at least at the first stage ;)
30th Apr 2018, 9:11 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 10
I've never tried Python in Excel but I might have to now, thanks for the link Kuba Siekierzyński. Whether to use Python or VBA may depend on what you're trying to develop the macro for. I find VBA very easy to use and great to work between applications.
30th Apr 2018, 8:08 PM
Duncan
Duncan - avatar
+ 9
I think you might be confusing VB with VBA, VB support finished about 10 years ago but as far as I'm aware VBA is very much alive. VBA has plenty of libraries and as I mentioned before, it's super simple to work with other applications just by adding them as a reference library. I've used VBA in Excel to update thousands of records on an old main frame many times as an example.
1st May 2018, 2:23 AM
Duncan
Duncan - avatar
+ 8
Thanks both, Kuba and Duncan for your quick answers. I am asking because I think Excel is one of the most useful tools I have worked with, even without using Macros, and I would like to start creating Macros now, but I am doubting about the language. I have read that VBA is not longer maintained by Microsoft, so despite being still in use, looks like kind of obsolete and replaced by VB.NET. On the other hand, using Python for macros is pretty attractive due to its clean syntaxis and powerful libraries for data analysis (numpy, scipy, pandas...). Considering this, does still make sense using VBA? Looking forward for your expertise opinion :)
30th Apr 2018, 8:36 PM
FBFJ
FBFJ - avatar
+ 8
David Rueda Robles Yep, been there, done that, too :)
1st May 2018, 1:55 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 7
When I've seen this question I have put my eyes like 💖💖💖. For me, Excel is a wonderful programme. I've been programming in excel without scripts, building an automatic time table for 50 persons. If you change one data, the time table re build it. I'll have very attention to this article. Thanks
1st May 2018, 1:49 PM
David Rueda 🇪🇸
David Rueda  🇪🇸 - avatar
+ 5
You are right Duncan, what finished for VBA was the supply of licenses to new users, but Microsoft has not been able yet of migrating its use on to .NET platform. Topic solved, thanks!!
1st May 2018, 7:55 AM
FBFJ
FBFJ - avatar
+ 5
when you record a macro in Excel or Word VBA is created in the background. you can open the module where it is stored to read or edit the code
3rd May 2018, 1:42 PM
Lisa F
Lisa F - avatar
+ 4
I have been writing VBA coding in Excel, and other office products, for over 20 years. I find VBA very useful and fast, if done properly. I’m looking forward to learning Python and am excited about the possibility of Microsoft adding Python as a scripting language.
2nd May 2018, 9:18 PM
David Farley
+ 4
I have learned some cool stuff
5th May 2018, 3:52 PM
Marik Brestovitsky
Marik Brestovitsky - avatar
+ 3
Hae gues python experts How do I call savadata function to a button in a tk software to savedata to a local db being entered to the tk?
2nd May 2018, 8:07 AM
Charles Lasiti pesi
Charles Lasiti pesi - avatar
+ 3
Microsoft announced today Javascript support for Excel functions, but not python. Available now for Office insider users. https://www.bleepingcomputer.com/news/microsoft/microsoft-adds-support-for-javascript-functions-in-excel/
8th May 2018, 7:46 PM
Udi Finkelstein
Udi Finkelstein - avatar
+ 2
wow nice. python in excel. I should try
7th May 2018, 3:43 PM
Arumugam
Arumugam - avatar
+ 2
Thanks for the link! I am just starting in python but I have a lot of experience in Excel so I will definitely be trying to put this to use together now :)
8th May 2018, 4:25 AM
Jiles Herron
Jiles Herron - avatar
+ 2
Thanks for the update Udi :)
8th May 2018, 7:48 PM
FBFJ
FBFJ - avatar
+ 1
nothing is possible... who are intrested in creating new things... should try python in exal...
8th May 2018, 6:08 AM
Dadi Sai Manisha
Dadi Sai Manisha - avatar
+ 1
Kuba Siekierzyński thanks for sharing, I wanted to apply what I learned from python (At SoloLearn) in my daily basis. I think this information is what I need.
8th May 2018, 12:59 PM
Ida Bagus Oka Jeve
Ida Bagus Oka Jeve - avatar