Results 1 to 6 of 6
  1. #1
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,832
    Thanks
    136
    Thanked 484 Times in 461 Posts

    Password protect CSV files (Excel2000)

    Does anyone know if there is a way of password-protecting CSV files?
    I sometimes use this file format to export and import data from/into Excel as it seems very efficient for network access, i.e. file sizes are considerably smaller than saving as Excel file format.

    zeddy

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Password protect CSV files (Excel2000)

    There is not, as far as I know, a way of passsword protecting csv files (one of the reasons they're smaller files, I suspect.). If you're on a network though, you ought to be able to use network security to prevent unwanted access, if that's an option?
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Password protect CSV files (Excel2000)

    Since CSV files do not have a specific application associated with them to handle the password, you can not directly password protect them.

    What you can do is get one of the file compression programs like WinZip, PKZIP, etc. that support password protection and use that to encrypt and password protect the file. That's not totally bullet proof, but it is better than nothing and it will make the file smaller yet.
    Legare Coleman

  4. #4
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Password protect CSV files (Excel2000)

    Try setting the attributes of the csv files to read only.

    John

  5. #5
    2 Star Lounger
    Join Date
    Mar 2002
    Location
    Western NY, USA
    Posts
    157
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Password protect CSV files (Excel2000)

    You could adopt a function like this to encrypt/decrypt data. If you encrypt only the data, not the whole file (I.E. ensure delimiters are still delimiters), you could write a routine to loop through the usedrange after import to decrypt. The routine is not highly secure, but it will stop the average bear.

    Pass in "HelloWorld" to get "aLEEF~F[EM" and pass in "aLEEF~F[EM" to get "HelloWorld"

    'Function retreived from www.vbcode.com

    Function EncryptPassword(Pwd As Variant) As String
    Dim Temp As String, PwdChr As Integer
    Dim EncryptKey As Integer

    EncryptKey = Int(Sqr(Len(Pwd) * 72)) + 15

    For PwdChr = 1 To Len(Pwd)
    Temp = Temp + Chr(Asc(Mid(Pwd, PwdChr, 1)) Xor EncryptKey)
    Next PwdChr

    EncryptPassword = Temp

    End Function

  6. #6
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,832
    Thanks
    136
    Thanked 484 Times in 461 Posts

    Re: Password protect CSV files (Excel2000)

    Thanks Rory - As I suspected.
    First line of defence is to use servers for file locations of course.
    My aim was to restrict access to the files other than through a custom Excel application.
    For Excel files, I use automated password protection to limit User access to the Excel files e.g. through Explorer.
    i.e. they are only loaded via the custom Excel application front-end as required.
    My CSV data could use the same method by storing the data in Excel file-format - it's just that the equivalent files are larger and therefore take longer to load from remote servers etc.
    I could use some of the techniques described in the other reponses here but the overhead would be probably greater than just using Excel file formats.
    Thanks to everyone for your replies!

    zeddy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •