[Tutor] Excel files to Tab delim files
Carlo Capuano
Carlo.Capuano at iter.org
Fri Jan 6 12:11:27 CET 2006
Hi,
If you run python on windows, you may also take the control of office
(word,excel) and may others tools,
for example image you have a mysheet.xls in C
import pythoncom, win32com.client,os
pythoncom.CoInitializeEx(pythoncom.COINIT_APARTMENTTHREADED)
excelapp = win32com.client.gencache.EnsureDispatch("Excel.Application")
excelapp.Workbooks.Open(Filename="C:\\mysheet.xls ")
excelapp.Range('A1').Select()
value = excelapp.ActiveCell.FormulaR1C1
#closing, strong way or the process may stay in the back ground
excelapp.ActiveWorkbook.Close(False)
excelapp.Quit()
del excelapp
value contains now what there is in A1, to see the syntax just record a
macro on excel and than edit it.
Except for the initialization of the Dispatcher the instruction are the
same, so you can almost copy and paste.
Carlo
this work fine in python2.3 too :-)
what is ITER? www.iter.org
> -----Original Message-----
> From: tutor-bounces at python.org [mailto:tutor-bounces at python.org] On
Behalf
> Of Srinivas Iyyer
> Sent: Thursday, January 05, 2006 11:35 PM
> To: tutor at python.org
> Subject: [Tutor] Excel files to Tab delim files
>
> Dear group,
> is there any library available that would convert
> over 2000 .xls files to tab delim text files.
>
> I have over 2000 Excel files and I want to convert
> them to tab delim files, which has become a pain in
> brain.
>
> Thanks
> Srini
>
>
>
> __________________________________________
> Yahoo! DSL - Something to write home about.
> Just $16.99/mo. or less.
> dsl.yahoo.com
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list