471,330 Members | 1,827 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

Win32com and Excel

Hi,

I currently have an excel table (1 table each time) that has differing
number of rows and differing number of columns each time, for another
program i use (SPSS) to import the data i need to know the cell range
of this data table.
I.e what the last row of data is and the last column that has data in
it.

Does anyone have any code that does something similar? My guess is i
have to do something like thefollowing to enable python to read xl?

import win32com.client
working_dir = '//c:/temp/'
xl = win32com.client.Dispatch("Excel.Application")
xl.Visible = 1 #open MS Excel
xl.Workbooks.Open('%s/working_output.xls' % (working_dir))

then code to find the cell ranges

Any help here is much appreciated

Mike
Jan 10 '08 #1
1 2823
On Behalf Of Mike P
Does anyone have any code that does something similar? My
guess is i have to do something like thefollowing to enable
python to read xl?
I think that what you want is UsedRange

for row in sheet.UsedRange.Value:
...

Regards,
Ryan Ginstrom

Jan 10 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by RJ | last post: by
1 post views Thread by Patrick | last post: by
1 post views Thread by koia | last post: by
2 posts views Thread by cfriedalek | last post: by
1 post views Thread by Ransom | last post: by
2 posts views Thread by Ray | last post: by
4 posts views Thread by sterling | last post: by
2 posts views Thread by korean_dave | last post: by
reply views Thread by rosydwin | last post: by

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.