473,473 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to learn to use python with Excel

I don't like VBA, and want to use python to work with Excel. Does
anybody recommend some good documents to begin with?

Many thanks,

Xiao-Qin
Jul 18 '05 #1
3 3406
On 2004-09-01, Xiao-Qin Xia <xx**@skcc.org> wrote:
I don't like VBA, and want to use python to work with Excel. Does
anybody recommend some good documents to begin with?

Many thanks,

Xiao-Qin

http://www.reportlab.com/ftp/talks/P...wsTutorial.doc
--
Tomasz Drobiszewski
id***@gazeta.usun.spam.pl
Jul 18 '05 #2
Xiao-Qin Xia wrote:
I don't like VBA, and want to use python to work with Excel. Does
anybody recommend some good documents to begin with?


Mark Hammond and Andy Robinson's book
(http://www.oreilly.com/catalog/pythonwin32/index.html) has good
coverage of such things. You can even read it online if you
subscribe to Safari.

There are also probably dozens of examples you can find on the
net here and there, or in the newsgroup/mailing list archives.
For example, this search should get you started:
http://groups.google.com/groups?q=gr...el.application

-Peter
Jul 18 '05 #3
On 1 Sep 2004, Xiao-Qin Xia wrote:
I don't like VBA, and want to use python to work with Excel. Does
anybody recommend some good documents to begin with?


As a quick-start example, this Python:

from win32com.client import Dispatch
excel = Dispatch("Excel.Application")

is equivalent to this VB:

Dim excel As Application
excel = CreateObject("Excel.Application")

After that, some calls even look identical:

ws = excel.ActiveSheet

eqv. to:

Dim ws as Worksheet
ws = excel.ActiveSheet

Any differences (I can't think of any off the top of my head) will likely
be found through trial and error... one major difference is that, in
addition to properties, VB doesn't want parenthesis after Sub calls
(functions of no arguments), whereas Python does. Fortunately it's pretty
easy to tell with Python; you'll either get a function object or an error
if you guess wrong (as I may have above).

win32com is included in the ActiveState distribution; if you otherwise
don't have it (unlikely), you can download it at
http://www.python.org/windows/win32com/.

Hope this helps.

Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
12
by: rhmd | last post by:
Just found Python and I love it. What an elegant language! I would like to use it for various applications, but the mathematical calculations are way too slow (a million sines 8 seconds in Python...
0
by: justin worrall | last post by:
Hi,   I have a very simple python win32 example (gleaned from the O'Reilly book on Win32 programming for Python), of an Excel client with a COM server. Essentially I have three VB buttons -...
2
by: Kevin T. Ryan | last post by:
Hi Group - I have written a "semi-program" in MS Excel related to running a football pool. I've updated it over the past two years or so, to the point where it is getting pretty advanced. ...
10
by: sam | last post by:
Hi group, I m wondering which Excel module is good to be used by Python? Thanks Sam
5
by: mbbx6spp | last post by:
Hi All, I already searched this newsgroup and google groups to see if I could find a Python equivalent to Perl's Template::Extract, but didn't find anything leading to a Python module that had...
8
by: Aziz McTang | last post by:
Hi Group, I am not an experienced programmer at all. I've learned html and css well enough to hand-write simple websites. I'm now looking to move to the next step. Initially, I'd like to do 3...
4
by: michael.pearmain | last post by:
Hi Experts, Looking for a very quick bit on of advice on how to make some python code run. I'm a newbie to both VBA and Python, so i apologise if this is very easy but i'm about to tear my hair...
6
by: AleydisGP | last post by:
I have a .plt file (which is a tab delimited ASCII file) and I want to format it to get a .dbf with data in rows and columns, detele some rows/columns and substitute decimal '.' with ','. All this...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.