import data from an Excel spreadsheet
Import(file, sheet, cells, emptycell=value)
(optional in Standard interface) string; the name of the Excel file from which to import data
(optional) string or positive integer; the name or index of the sheet from which to import data (default: 1)
(optional) string; the cell range to import (default: the entire sheet)
(optional) anything; the value given to blank cells in the spreadsheet (default is 0.0)
labeltype : one of symbol or string
When output=DataFrame, this option specifies whether non-numeric row and column labels should be expressed as symbols or strings when constructing the DataFrame.
The default is symbol.
output : one of Matrix or DataFrame
This option specifies the desired method for representing the imported data in Maple.
The default is Matrix.
The Import(file,sheet,cells) function imports the data from the Microsoft Excel workbook file, as addressed by the sheet and cells parameter, into a Matrix.
Both the XLSX (Office Open XML) and XLS (Excel 97-2003) file formats are supported.
In the Standard interface, if the file parameter is not provided, a dialog will be presented with a field for the target file name. In all other interfaces, the file parameter is required.
The sheet parameter can be either the name of a sheet within the file or a 1-based index.
The cells parameter can be a standard cell range, for example, "A1:B9" or "c$10..$w15", or a named range. If it is given as a named range, that name must already exist in the Excel file.
If cells is given as a single cell address, for example "D13", this is taken as the top-left corner of the required range, with the bottom-right corner taken to be the bottom-right corner of the sheet. (To import just a single cell, specify it as a range, for example "AQ3:AQ3".)
Spreadsheets can contain empty cells in the midst of other data. By default these cells are given the value 0.0 upon import. Use the emptycell option to specify a different value. For example, emptycell=undefined, or emptycell="".
To perform the following examples, you should create an Excel spreadsheet named Employees.xlsx with the necessary sheets and cells.
Q ≔ Import⁡Employees.xlsx,Payroll,B2:C9:
Indexing only the upper left corner brings in all the rest of the sheet
R ≔ Import⁡Employees.xlsx,Payroll,B2:
A cell range can be specified via a name
P ≔ Import⁡Employees.xlsx,FirstQuarter:
Sheets can be indexed as well as named
S ≔ Import⁡Employees.xlsx,2,A1:w25:
Import all of the first (or only) sheet
T ≔ Import⁡Employees.xlsx:
(Standard interface only) Open a dialog to enter the file name and other data
T ≔ Import⁡
The ExcelTools[Import] command was updated in Maple 2023.
The labeltype and output options were introduced in Maple 2023.
For more information on Maple 2023 changes, see Updates in Maple 2023.
Download Help Document