title: Parse files in a directory that contain a match to a set of strings - pull line with match to new file
body: <p>I need to parse through a directory of <em>multiple excel files</em> to find matches to a <em>set of 500+ strings</em> (that I currently have in a set). </p>
  
  <p>If there is a match to one of the strings in an excel file, I need to <em>pull that row out into a new file</em>. </p>
  
  <p>Please let me know if you can assist! <strong>Thank you in advance for the help!</strong></p>
  
  <p>The directory is called: All_Data</p>
  
  <p>The set is from a list of strings in a file (MRN_file_path) </p>
  
  <p>My code:</p>
  
  <pre><code>MRN = set()
  with open(MRN_file_path) as MRN_file:
      for line in MRN_file:
          if line.strip():
              MRN.add(line.strip())
  
  for root, dires, files in os.walk('path/All_Data'):
      for name in files:
          if name.endswith('.xlsx'):
              filepath = os.path.join(root, name)
              with open(search_results_path, "w") as search_results:
                  if MRN in filepath:
                      search_results.write(line)
  </code></pre>