xlsread and password protected Excel files
Mostra commenti meno recenti
There is nothing in the xlsread help file about passwords & the xlsprotect fuction (file exchange) does not work (all it does is hang & you have to shift to the Excel window to enter your password).
Does anybody know how to do this properly from a Matlab file?
1 Commento
Ehtisham
il 28 Giu 2021
Go and download this code. It will protect the excel file with password. The files won't remain editable unless you unprotect them by providing the password.
Risposta accettata
Più risposte (3)
Joseph Cheng
il 11 Set 2014
you would have to use activeX. Since getting data from excel using activeX is documented fairly well i'll leave here how to open a file with the password.
[fname pname]=uigetfile('protected.xlsx');
password = 'password';
xlsAPP = actxserver('excel.application');
xlsWB = xlsAPP.Workbooks;
xlsFile = xlsWB.Open([pname fname],[],false,[],password)
xlsFile.Visible = 1;
where i hard coded the password with password and my test xls file was protected.xlsx.
1 Commento
Joseph Cheng
il 11 Set 2014
there is a function on the file exchange called xlsprotect which looks to be able to unprotect and protect the file again but that maybe problematic in a security standpoint (the xls files were protected for some reason) and if program crash or hangup the reprotect wouldn't occur.
Les
il 11 Set 2014
0 voti
Les
il 11 Set 2014
0 voti
Categorie
Scopri di più su Spreadsheets in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!