← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #662729]: If answer is yes then skip, if answer is no then execute.

 

Question #662729 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/662729

    Status: Open => Answered

masuo proposed the following answer:
That is "xlrd" not "xldr".

http://xlrd.readthedocs.io/en/latest/api.html

[example codes:]
import xlrd
import datetime

book = xlrd.open_workbook("C:\\temp\\book1.xlsx")
sheet = book.sheet_by_index(0)
for col in range(sheet.ncols):
    for row in range(sheet.nrows):
        dtype = sheet.cell_type(row,col)
        value = sheet.cell(row,col).value
        if dtype == 1: #TEXT
            print "col:%d row:%d value:%s" % (col,row,value)
        elif dtype == 2: #NUMBER
            print "col:%d row:%d value:%d" % (col,row,value)
        elif dtype == 3: #DATE
            s = datetime.datetime(*xlrd.xldate_as_tuple(value,book.datemode)).strftime("%Y/%m/%d")
            print "col:%d row:%d value:%s" % (col,row,s)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.