title: ezPyCrypto to Encrypt an MS Excel File
body: <p>I am trying to password-protect an MS Excel file via Python.
  I found so far that this is not possible via common Excel libraries such as openPyXL and XLSX Writer.</p>
  
  <p>I assume this means that I first need to encrypt it. 
  Please correct me if I am wrong or if there is a better approach. </p>
  
  <p>The password-protection bit is the most important, which is not addressed below, unless it's easy to add code to this to that effect.</p>
  
  <p>So far, here's what I have for encryption:</p>
  
  <pre><code>from ezPyCrypto import key
  file_in = r'P:\Data\sample_file.xlsx'
  file_out = file_in[:-5]+'_enc.xlsx'
  
  f_in = open(file_in, 'rb')
  f_out = open(file_out,'wb')
  
  in_str = f_in.read()
  out_str = key(in_str)
  f_out.write(out_str)
  
  f_in.close()
  f_out.close()
  </code></pre>
  
  <p>However, I keep getting this error:</p>
  
  <pre><code>ImportError                               Traceback (most recent call last)
  &lt;ipython-input-36-ed5218b0d47c&gt; in &lt;module&gt;()
        2 #https://github.com/sfbahr/PyCrypto-Wheels
  ----&gt; 3 from ezPyCrypto import key
        4 file_in = r'P:\Data\sample_file.xlsx'
        5 file_out = file_in[:-5]+'_enc.xlsx'
  
  C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\ezPyCrypto.py in &lt;module&gt;()
       70 from Crypto.Util.randpool import RandomPool
       71 from Crypto.Util.number import getPrime
  ---&gt; 72 from Crypto.Cipher import ARC2, Blowfish, CAST, DES3, IDEA, RC5
       73 from Crypto.Hash import MD5
       74 
  
  ImportError: cannot import name 'IDEA'
  </code></pre>
  
  <p>I tried downgrading to earlier versions of Crypto (back to 1.0.0) but keep getting the same error, which looks for 'IDEA' within Crypto.Cipher.</p>
  
  <p>Thanks in advance!</p>