8 ms·
Show HN: Script Excel with Python
- smortaz 14y agoThis is great guys! We cooked up a similar thing called Pyvot (pivot). It's OSS/Apache - feel free to take/contribute. Cheers, smortaz@microsoft. Video: http://www.youtube.com/watch?v=Oi3QKuFugWk&hd=1 http://www.youtube.com/watch?v=Oi3QKuFugWk&hd=1 edit - link to project: http://pytools.codeplex.com http://pytools.codeplex.com
- roryokane 14y agoMore specific link to Pyvot project: http://pytools.codeplex.com/wikipage?title=Pyvot http://pytools.codeplex.com/wikipage?title=Pyvot. My understanding of the difference between the links: Pytools in general lets you run Python programs in Visual Studio. Pyvot is a part of Pytools that lets any Python code on Windows (including code run in Visual Studio) connect to Excel.
- adorton 14y agoImpressive. Would people I share a spreadsheet with need the plugin?
- cschmidt 14y agoIs this an open source project, or are you planning to sell it?
- jaxn 14y agoREALLY wish this was available for Mac.
- paduc 14y agoYep, me too! Would it be possible to use this as a standalone (command line for instance) and not a plugin?
- vj44 14y agoSorry, it's not possible now. Microsoft's technology is not there yet at MacOS.
- josteink 14y agoAsk Apple for something equivalent of Windows COM+ and convince them they have a good reason for doing so once they stop laughing, and then you might have it.
- jodoherty 14y agoI realize this isn't the same thing, but a lot of Mac apps are scriptable through Apple's Open Scripting Architecture [1], so it's more than possible to use Python [2] or Ruby [3] or any other language with an OSA bridge to access and reuse application functionality or to automate tasks. According to Wikipedia, Microsoft Office 2008 supports OSA, so it's worth investigating with Microsoft Office 2011. You can use the ASDictionary app from the appscript page [4] to see what scriptable functionality, if any, various Microsoft Office for Mac applications support. References: [1] https://developer.apple.com/library/mac/#documentation/applescript/conceptual/applescriptx/concepts/osa.html https://developer.apple.com/library/mac/#documentation/apple... [2] http://appscript.sourceforge.net/py-appscript/index.html http://appscript.sourceforge.net/py-appscript/index.html [3] http://rubyosa.rubyforge.org/ http://rubyosa.rubyforge.org/ [4] http://appscript.sourceforge.net/tools.html#asdictionary http://appscript.sourceforge.net/tools.html#asdictionary
- iamdave 14y agoThis is awesome! I plan to use this 100%. Sent it to a few other excel power users in my org, thank you for this
- karamazov 14y agoThat's great!
- danielalela 14y agoniiiice! :) python is definitely better than vba, didn't think of this use for it!
- mdda 14y agoFWIW LibreOffice does Python natively.
- nchlswu 14y agoThis seems really cool, but I'm admittedly not familiar with this area. How does this compare or supplement to Excel VBScript?
- karamazov 14y agoOur goal is to replace VBScript. We'll have the same basic functionality, but using Python instead of VB, and with access to all of Python's libraries. It's backwards compatible too - you can run VBA scripts and Python scripts at the same time.
- yangyang 14y agoNice. Also see PyXLL (http://pyxll.com/ http://pyxll.com/), which lets you write Excel plugins in Python (CPython).
- sandGorgon 14y agoThanks for this - it indeed looks much more powerful (being able to interact with Excel using Python as well as making python functions available to Excel). Just saw this example - http://dpinte.wordpress.com/2010/03/12/interactive-python-graphicsvisualisation-with-excel/ http://dpinte.wordpress.com/2010/03/12/interactive-python-gr...
- mwexler 14y agoThat's very clever. However, the ultimate integration of spreadsheet and Python has got to be ResolverOne (http://www.resolversystems.com/products/resolver-one/ http://www.resolversystems.com/products/resolver-one/) It's a really amazing experience.
- dbecker 14y agoI don't doubt that ResolverOne is a great experience... but so many businesses are wedded to Excel (and VBA). I expect IronSpread will see much more use than ResolverOne because it will integrate into these offices more easily.
- bmccormack 14y agoI still have a soft spot for VBA, especially in Excel. I wrote a supply-chain management application in Excel+VBA that's still in production today. As comfortable as I am with VBA, I wouldn't mind in the least ditching it for Python, which makes writing routine methods trivial. Great work!
- karamazov 14y agoGlad you like it! We're also backwards compatible - you can keep running old VBA code, and write new scripts in Python.
- dkhenry 14y agoThe big question I have is why would I use this instead of a real database. If i am not mistaken excel can hook up to ODBC sources and then I can just script things as I normally would using the database drivers.
- karamazov 14y agoIf you want to script something quickly, Python is better; you also have access to all of Python's libraries (numpy/pylab, for example). It depends on what you're doing, though.
- mattmanser 14y agoHoho, you ever sniffed the real world out there? Hell of a lot more excel junkies than programmers.
- il 14y agoAny plans for OS X support?
- karamazov 14y agoNot currently.
- shazam 14y agoThat's funny, I just used xlrd and xlrt and had to convert about 100 files to 97-2003 workbooks
- jimberino 14y agoXLRD and XLRT look awesome - esp. for us *nix minded folks who prefer to interact with xls files from a shell, http://www.python-excel.org/ http://www.python-excel.org/
- mcarvin 14y agoGreat work. I am a long time finance geek - this will make life decidedly easier.
- willyt 14y agoHonest question; I havent tried to script xl or word for years. What is this doing that I couldn't do with IronPython or IronRuby?
- steve8918 14y agoWhat is the licensing for this? I couldn't tell whether this was free, if I had to pay, if it was open source, GPL, etc.
- karamazov 14y agoIt's a free beta. We'll be charging for it down the line, but you can use this however you like for now. (It's not open source, though.)
- jlarocco 14y agoWhy would I use this when I can already connect to Excel using COM for free?
- ZoFreX 14y agoThat's the most perfectly ambiguous sentence I've ever seen on here, I actually can't tell if you're being sarcastic or not. Are you?
- jlarocco 14y agoIt was a real question. COM isn't hot new technology, but it works, costs $0 above and beyond Excel, and can access as much (or more) of Excel. The reason I ask is that after a quick look, the IronSpread examples don't look too much different than accessing Excel via plain old COM. [1] And there's even a chapter in a book [2] for accessing Excel from Python through COM. And example code [3] for wrapping Excel COM in a Python class. I guess put another way, my question would be what does IronSpread offer above and beyond the regular access from COM? [1] http://stackoverflow.com/questions/441758/driving-excel-from-python-in-windows http://stackoverflow.com/questions/441758/driving-excel-from... (the second answer) [2] http://my.safaribooksonline.com/1565926218/ch09-84996 http://my.safaribooksonline.com/1565926218/ch09-84996 [3] http://dzone.com/snippets/script-excel-python http://dzone.com/snippets/script-excel-python
- ivolo 14y ago
- moolcool 14y agoAny plans to support pivot tables?
- karamazov 14y agoWe will soon!
- pneumatics 14y agoThis isn't necessary, you can have access to the full Excel COM API, with tab-completion, backwards-compatibility etc, for free with iPython and the makepy.py script. http://stackoverflow.com/a/445961 http://stackoverflow.com/a/445961 Though I admit scripting Excel from Python should be easier to setup than it is.
- canuc 14y agoI love you. So much.
- dbecker 14y agoThis solves a real business problem for a lot of people. I'm doubly impressed that it was done by a recent grad and someone still in school. You guys have a bright future in front of you.
- jijoy 14y agoThis is awesome. Great Work !!
- edwinyzh 14y agoThis is very interesting! Wrapping the entire Excel object model in Python must be a huge work.
- asto 14y agoCalligra Sheets allows scripting with python, ruby and js! http://en.wikipedia.org/wiki/Calligra_Sheets http://en.wikipedia.org/wiki/Calligra_Sheets
- AlexDanger 14y agoThis is great. I have to work with some very complex excel/VBA apps and this will be a breath of fresh air. Is there anything out there that allows using C# to script/control excel?
- Pyinex 14y agoDone two years ago: Code.google.com/p/pyinex O.83 alpha version includes the code.
- fonzie 14y agoThis seems pretty great. Any plans for compatibility with Excel 2003 and 2007?
- karamazov 14y agoWe'll be compatible with 2007 in a day or two. We're not currently planning on supporting 2003, but this might change.
- fonzie 14y agoAwesome. You may already know, but a huge proportion of the large finance firms are still stuck with 2003 and from speaking to a few people, they don't seem super ready to change. Given you are planning on selling it, these guys would probably be decent customers.
- pyxll 14y agoIf you want to call Python functions from Excel in the form of user defined functions, macros or menu functions (including macros bound to UI widgets and application events) you should take a look at PyXLL (www.pyxll.com). This has been around for a couple of years now and actively maintained and supported, and is in use by many organisations already. It supports all versions of Excel from 2000 onwards, with some features only available in later versions (eg asynchronous functions are only in Excel 2010). It uses cPython so all the standard libraries are usable. Calling back into Excel is quite straightforward using win32com, and there are examples on the website that show how to do that. With PyXLL you can write plain Python code that you can use outside Excel as well - so it's quite easy to write a library of functions that can be called from normal Python scripts as well as expose them to Excel at the same time. I'm not sure what this project adds over what's already available but I'd be very interested to hear what other people's opinons are.
- bradleyy 14y agoFrom a conversation with them, they are intending to charge around $2000/seat/month. This takes it out of the realm of possibility for me, but http://excel-dna.net/ http://excel-dna.net/ looks like it will fit the bill with a little elbow grease.