Open XLSX File

Information, tips and instructions

XLSREAD in MatLab

Excel files, spreadsheets, especially XLSX can be read through matrices or MATLAB arrays. It is possible to import data from spreadsheets interactively by programming or through a series of specific commands. You can import a selected range of data or import different spreadsheets from spreadsheet files.

XLSX is the usual saving format for tables in Microsoft Excel, since 2007. XLSX file represents a spreadsheet where you can perform operations, create chats and perform other operations. Before the Office 2007 version, Excel tables were saved as an XLS file. Starting with this version, Excel uses the XML-based XLSX file format by default. Compared to XLS, an XLSX file is a kind of compressed folder where the XML and graphic files displayed in the spreadsheet are stored. The different parts of the document, such as tables or text, are saved individually and consolidated in the file.

MATLAB is a computing and numerical programming environment that offers an IDE with its own programming language (M language). It is available for Unix, Windows, macOS, and GNU / Linux platforms. Among its basic features are the manipulation of vectors, matrices, data management and implementation of algorithms for digital data and signal processing, as well as the creation of graphical user interfaces.

Due to MatLab's ability to process data and matrices, its use in reading, creating and modifying XLSX files is fully feasible.

For reading, the XLSREAD command is used, where you can specify the sheet, the range and the cells you need.

Below is an example of xlsread command:

num = xlsread (filename) reads the first worksheet in the XLSX workbook named filename and saves the numeric data to an array.

filename = 'Example.xlsx';

A = xlsread (filename)

It is also possible to create XLSX files through the XLSWRITE command where you need to speciy values, either numerical or letters. You will also need to specify headings (columns), and finally the file name.

values = {1, 2, 3; 4, 5, 'x'; 7, 8, 9};

headers = {'First', 'Second', 'Third'};

xlswrite ('Example.xlsx', [headers; values]);