How to import the data from a password protected XLSX file in MATLAB?

34 views (last 30 days)
How to import the data from a password protected XLSX file in MATLAB?
I have to import data from a password protected XLSX file. How can I do that in MATLAB?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 13 Apr 2023
Edited: MathWorks Support Team on 13 Apr 2023
To import the data from the password protected XLSX file you can use any of the following possible solutions:
1. You can import the data into MATLAB interactively, using the Import Tool. Please refer to the following link for more information on using the Import Tool:
Here, once you select the XLSX file to import the data, you need to enter the password for the file in the Password window that comes up.
2. You can create a table from the file using the "readtable" function. Here, after executing the following command in the Command Window, you need to enter the password for the file (specified in the filename) in the Password window that comes up:
>> T = readtable(filename);
Starting with R2018b, you will need to manually direct MATLAB to use Excel to open the file:
>> T = readtable(filename, 'UseExcel', true);
Please refer to the following documentation for more information on using the "readtable" function:
3. You can access the spreadsheet data from MATLAB by running the Excel application in an Automation server process using the "actxserver" function. Please refer to the attached example script, "passwordProtectedRead.m" that demonstrates reading the data from a password protected XLSX file, "passwordExample.xlsx", using the "actxserver" function. Also, please refer to the following link for more information on reading spreadsheet data using Excel as Automation server:

More Answers (0)

Products


Release

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!