[Tutor] Traversing Excel Columns

Chris Hengge pyro9219 at gmail.com
Tue Sep 12 00:36:53 CEST 2006


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 <kent37 at tds.net> wrote:
>
> 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" % (row, xlSht.Cells (1+row,
> 5).Value)
> >
> > 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).Value)
>
> What is xlSht? Are you using COM, or xlrd, or pycelerator, or?? to read
> the spreadsheet? It probably has a way to find out the last row, or if
> the cell has data...
>
> Kent
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060911/2d4915f3/attachment.htm 


More information about the Tutor mailing list