| |
---|
| | |
---|
| | PROGNAME = "xlslu.py" |
---|
| | PROGENV = "xlslu".upper() |
---|
| | VERSION = "1.201" |
---|
| | PROGVER = PROGNAME + " " + VERSION + " - Match Strings In XLS Spreadsheets" |
---|
| | |
---|
| | |
---|
| | ##### |
---|
| | # Copyright Information |
---|
| | ##### |
---|
| | |
---|
| | COPYRIGHT = "" |
---|
| | PROGVER = PROGNAME + " " + VERSION + " - Simple Spreadsheet String Search" |
---|
| | |
---|
| | |
---|
| | ##### |
---|
| | # List Of All Legal Options - Update This When You Add More!!!! |
---|
| | ##### |
---|
| |
---|
| | |
---|
| | for row in range(sheet.nrows): |
---|
| | |
---|
| | matched = False |
---|
| | nummatched = 0 |
---|
| | matchedstrings = {} |
---|
| | content = [] |
---|
| | for col in range(sheet.ncols): |
---|
| | |
---|
| | # Get value |
---|
| | |
---|
| | value = str(sheet.cell(row, col).value) |
---|
| | |
---|
| | # Save, in case we match below and have to report it |
---|
| | content.append(value.strip()) |
---|
| |
---|
| | |
---|
| | for matchstring in MATCHSTRINGS: |
---|
| | if value.lower().count(matchstring.lower()): |
---|
| | matched = True |
---|
| | nummatched += 1 |
---|
| | matchedstrings[matchstring] = True |
---|
| | |
---|
| | # Deal with AND Matching |
---|
| | |
---|
| | if ALLSTRINGS and (nummatched != len(MATCHSTRINGS)): |
---|
| | if ALLSTRINGS and (len(matchedstrings) != len(MATCHSTRINGS)): |
---|
| | matched = False |
---|
| | |
---|
| | # Report matching entries |
---|
| | |
---|
| | |