Browse Source

Adding row validator with trivial default behavior to importXLSX

Andrej 1 month ago
parent
commit
ff51469010
1 changed files with 7 additions and 1 deletions
  1. 7 1
      importXLSX.py

+ 7 - 1
importXLSX.py

@@ -310,8 +310,12 @@ def getId(df,r):
 def convertLookup(xlsColumnName):
    return True
 
+def rowValid(df,r):
+   return True
+
 def importData(pars,filename,getId=getId,modify=modify,\
-   convertLookup=convertLookup,dryRun=True,debug=True):
+   convertLookup=convertLookup,dryRun=True,debug=True,
+   rowValid=rowValid):
 #master routine that imports data based on pars, 
 #applies user supplied functions modify, convertLookup and get Id and 
 #updates relevant database
@@ -360,6 +364,8 @@ def importData(pars,filename,getId=getId,modify=modify,\
 
    entries=[]
    for r in idx:
+      if not rowValid(df,r):
+         continue
       id=getId(df,r)    
       entry={}
       entry['ParticipantId']=id