Re: [Tutor] Traversing Excel Columns

2006-09-13 Thread Chris Hengge
I'll give that a shot tomorrow when I work on the script some more. Thanks for the note on 'file'... none of the IDE's I've used have colored or yelled at me, so I just assumed it was free for the taking.. (used to VS where it yells at you for more then I'd care) I've just started using SPE thou

Re: [Tutor] Traversing Excel Columns

2006-09-12 Thread Alan Gauld
> I can get file.write("'%s',") % xlSht.Cells(row,1).Value > to work.. file.write("'%s'," % xlSht.Cells(row,1).Value) Try that The string formatting must happen inside the parens. BTW using 'file' as a variab;e is not good since file is a built-in function name (albeit an alias for o

Re: [Tutor] Traversing Excel Columns

2006-09-12 Thread Chris Hengge
I got it working!   try:#Attempt to record the fields from the excel file.    row = 10 #Set the row in excel.    #While the cell isn't 'None', keep looping.    #Excel (row,col) for navigation    while xlSht.Cells(row,1).Value != None:     print >> file, "'%s'," % xlSht.Cells(row,1).Value,  

Re: [Tutor] Traversing Excel Columns

2006-09-12 Thread John Fouhy
On 12/09/06, Chris Hengge <[EMAIL PROTECTED]> wrote: > I'm not sure what internal blanks means.. but I'll take a stab and say > "no", there are going to be NO blanks once I start reading the column > unless there are no more values to read... null or "" would be fine for > a stopping point. Well,

Re: [Tutor] Traversing Excel Columns

2006-09-12 Thread Etrade Griffiths
Chris are you looking for something like this? xlSht=xlApp.Worksheets("Sheet1") irow=1 XL_row_has_data=1 while XL_row_has_data: xlRng=xlSht.Range(xlSht.Cells(irow,1),xlSht.Cells(irow,256)) ncell=xlApp.WorksheetFunction.CountA(xlRng) if ncell ==0: # Cells in current row

Re: [Tutor] Traversing Excel Columns

2006-09-12 Thread Chris Hengge
I'm not sure what internal blanks means.. but I'll take a stab and say "no", there are going to be NO blanks once I start reading the column unless there are no more values to read... null or "" would be fine for a stopping point. also, what is makepy.py? I'm still working through a couple books

Re: [Tutor] Traversing Excel Columns

2006-09-11 Thread John Fouhy
On 12/09/06, Chris Hengge <[EMAIL PROTECTED]> wrote: > I don't suppose that anyone has a fix for me eh? I've tried about all I > can think of and I'd like to be able to give this program a trial > tomorrow when I get back to work.. sure would save me some time :] Will there be internal blanks? Yo

Re: [Tutor] Traversing Excel Columns

2006-09-11 Thread Chris Hengge
I don't suppose that anyone has a fix for me eh? I've tried about all I can think of and I'd like to be able to give this program a trial tomorrow when I get back to work.. sure would save me some time :] On Mon, 2006-09-11 at 17:48 -0700, Chris Hengge wrote: > Hmm... ok... after some thought... t

Re: [Tutor] Traversing Excel Columns

2006-09-11 Thread Chris Hengge
Hmm... ok... after some thought... this is what I'm looking for   #some great line that gives me an int for the number of not null cells intLastUsedRow = xlSht.Cells.LastValue #Made this up, but basically what I need.   I need to iterate through a range() because I dont know another good way to tel

Re: [Tutor] Traversing Excel Columns

2006-09-11 Thread Chris Hengge
Just tried that (pretty sure I already did, but hey... I could have goofed it)   No go  On 9/11/06, Alan Gauld <[EMAIL PROTECTED]> wrote: I'm no expert in Excel programming but I assum,e you triedthe obvious:> I'm looking for something more like > try:#Loop until rows are null>while row in xlwk

Re: [Tutor] Traversing Excel Columns

2006-09-11 Thread Chris Hengge
from win32com.client import Dispatch soo... that would be com.. sorry about that.. xlSht is the worksheet I'm currently reading from.   On 9/11/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Chris Hengge wrote:> This is what I have, but it requires me to know the end of the column> I'm working with,

Re: [Tutor] Traversing Excel Columns

2006-09-11 Thread Alan Gauld
I'm no expert in Excel programming but I assum,e you tried the obvious: > I'm looking for something more like > try:#Loop until rows are null >while row in xlwksht != null > #Write each row, incriment 1+row in column 5 > print >> file, "'" + %s + "',", % > (xlSht.Cells(1+row,5

Re: [Tutor] Traversing Excel Columns

2006-09-11 Thread Kent Johnson
Chris Hengge wrote: > This is what I have, but it requires me to know the end of the column > I'm working with, which changes. > > try:#Loop through the rows from 6 -> 25 > for row in range(6, 25): > #Write each row, increment 1+row in column 5 > print >> file, "(%d) => %s" %