How to: Encrypt a CSV
Whether you are working with personal data or business data, chances are you will face a scenario where you would like to add some protection to your file(s). The most common method to encrypt a file is to add password-protection, so that only the user(s) with the password/passcode may access the file. While you may already have security measures in place on your servers, disks, etc. - you may still have a need to do file-specific encryption. This is especially true if you will be sharing data outside the protected environment.

Some examples when encryption would be commonplace include:

  • Handling confidential HR data, including personally identifiable details like social security numbers, addresses, etc.
  • Recording transactions that include sensitive data, such as credit card numbers
  • Dealing with business-sensitive information, like client lists, legal matters and more
  • Personal data, such as usernames & passwords, etc.

Now for a splash of cold water - you can't actually encrypt a CSV file directly. CSV files are simply plain text, and have no bells-and-whistles features to apply to them. If you open one up in a Text Editor program, you'll see no option there to add encryption.

However, it is very easy to save your CSV in a format that will allow you to add password encryption. The method to encrypt your file(s) will depend on the operating software you use (Mac or Windows), but they are very similar.
Option 1:

Compress your CSV file to a zip folder, and them encrypt that folder.

Using Windows, you can navigate to the properties of the zipped folder, select "Advanced" and then check the box to encrypt the contents. You will then be prompted to add the password of your choice.
Using Mac it's a bit more tricky, but still very doable. You will have to add the password encryption using Terminal. If that sounds intimidating, don't let it get to you! Simply open up Terminal, and type the following:

  • cd [folder where your file is saved]
  • zip -er [file name, including ".zip" extension]
  • enter the password of your choice
Option 2:

Import the CSV file into a spreadsheet software (like Excel or Numbers) and then add your password encryption. Remember, if you're going to use CSV in Excel, for example, it is always best to import the file rather than just open it!

If using Excel, select File > Info and then "Protect Workbook". Select the option to encrypt with a password, and then select the password of your choice.
If using Numbers on Mac, you will select File > Set Password and then add the password of your choice.
There you have it, a few simple methods to encrypting your CSV file(s).