473,671 Members | 2,319 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python <=> Excel question


Newbie questions:

Suppose abc.xls has sheets a, b, c.

How can I find, in Python, the sheet names?

Given a sheet name, how can I export the sheet as a csv file?

Finally, how can I, in Python, make a .txt version of a Word document?

Thanks,

Gerry
Sep 30 '05 #1
3 2065
On 9/30/05, Gerry Blais <ge**********@g mail.com> wrote:
Finally, how can I, in Python, make a .txt version of a Word document?


http://www.brunningonline.net/simon/...es/001299.html

--
Cheers,
Simon B,
si***@brunningo nline.net,
http://www.brunningonline.net/simon/blog/
Sep 30 '05 #2
> Suppose abc.xls has sheets a, b, c.
How can I find, in Python, the sheet names?
Given a sheet name, how can I export the sheet as a csv file?


http://chicago.sourceforge.net/xlhtml/

This has options to output csv files, the list of sheets and many other
things. Just execute this on the .xls file and read the files that it
produces.

Sep 30 '05 #3
Gerry Blais wrote:
Newbie questions:

Suppose abc.xls has sheets a, b, c.

How can I find, in Python, the sheet names?

Given a sheet name, how can I export the sheet as a csv file?

Finally, how can I, in Python, make a .txt version of a Word document?


I think Google will help you to find plenty of solutions to these
things. It's probably better to try something out and come here if
you're really stuck. You might want to start with this...
http://www.markcarter.me.uk/computing/python/excel.html

In general, it's typically helpful to use the VBA editor in Excel
to discover what the object model looks like, what methods there are
and what parameters they take etc. Then you can use this from Python
via win32com.client instead. You need the win32all extensions for
Python (or something like ctypes, but I never used that). ActivePython
contains win32all by default, but it's simple to install win32all for
a vanilla Python installation. It's reachable through the normal
Python download page (or via Google of course).

I'm sure some experimentation based on these hints can solve your
problem. It takes some time to understand the object model, and
how it maps to the Python interface, but it's not rocket science.

This book is really helpful for understanding how to use Python with
e.g. Word and Excel:
http://www.amazon.com/exec/obidos/tg...l/-/1565926218
Oct 4 '05 #4

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

Similar topics

2
3210
by: Eshrath | last post by:
Hi, What I am trying to do: ======================= I need to form a table in html using the xsl but the table that is formed is quite long and cannot be viewed in our application. So we are writing one object in C# which will take the entire table tag contents and renders. Ie., we need to pass "<table>………… <thead>……</thead>. <tr>.<td> <td>..<tr>.<td> <td> </table>" content to
2
10555
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script type="text/javascript"> <!]> </script> <script type="text/javascript"
3
28505
by: zxo102 | last post by:
Hi there, I need your help for python <--> excel. I want to paste selected cells (range) to different location on the same sheet in Excel through python. I have tried it for a while but could not figure it out. Here is my sample code: import win32com.client xl=win32com.client.Dispatch("Excel.Application") xl.Visible=1 wb = xl.Workbooks.Add( )
3
2759
by: | last post by:
I have been researching articles on google on how to create a simple RSS feed that sucks <title><blurb><link><date> out of a sql server 2000 database via an aspx page. I know it has to be pushed into a <xml> document but not sure which direction to take. Is there perhaps a starter document which uses sql server as the data source I can tap into.
2
1075
by: kuhni | last post by:
Hi All, I have a very general question regarding the interoperability of VB/VBA applications. I know that it is possible to create a form e.g. in Excel from which I launch Word and then show the Excel form on top of Word. But I cannot manage to show a form - which I have created in a stand-alone Visual Basic application (using its VBA Editor) - on top of
2
345
by: Harry | last post by:
Hi All, It is nice to join the python group. Can someone please help me with a python question? I have the following object which is like a list of tuples What command do I use to get the value corresponding to 'min'? This object seems to be non-indexable row=
1
1276
by: Scheol Service | last post by:
---------- Forwarded message ---------- From: Scheol Service <scheols@gmail.com> Date: Nov 29, 2006 10:57 PM Subject: Python Question About Compiling. To: mailto:python-list@python.org Im just unsure on how to compile python code into .exe executionable files. Is there a simple way to do this?
3
3368
by: ajay2552 | last post by:
Hi, I have a query. All html tags start with < and end with >. Suppose i want to display either '<' or '>' or say some text like '<Company>' in html how do i do it? One method is to use &lt, &gt ,&ltCompany&gt to display '<', '>' and '<Company>' respectively. But is there any freeware code available which could implement the above functionality without having to use &gt,&lt and such stuff???
14
3139
by: Michael | last post by:
Since the include function is called from within a PHP script, why does the included file have to identify itself as a PHP again by enclosing its code in <?php... <?> One would assume that the PHP interpreter works like any other, that is, it first expands all the include files, and then parses the resulting text. Can anyone help with an explanation? Thanks, M. McDonnell
0
8390
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8819
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8597
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8667
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6222
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5692
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4222
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2808
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2048
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.