ExcelTools - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Input and Output : File Manipulation : ExcelTools : ExcelTools/Import

ExcelTools

  

Import

  

Import data from an Excel spreadsheet

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

Import(file, sheet, cells, emptycell=value)

Parameters

file

-

(optional in Standard interface) string; the name of the Excel file from which to import data

sheet

-

(optional) string or positive integer; the name or index of the sheet from which to import data (default: 1)

cells

-

(optional) string; the cell range to import (default: the entire sheet)

value

-

(optional) anything; the value given to blank cells in the spreadsheet (default is 0.0)

Description

• 

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 2-dimensional Array, with both indices starting from 1.

• 

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=.

Examples

To perform the following examples, you should create an Excel spreadsheet named Employees.xlsx with the necessary sheets and cells.

withExcelTools:

QImportEmployees.xlsx,Payroll,B2:C9:

Indexing only the upper left corner brings in all the rest of the sheet

RImportEmployees.xlsx,Payroll,B2:

ArrayDimsR

1..12,1..10

(1)

A cell range can be specified via a name

PImportEmployees.xlsx,FirstQuarter:

Sheets can be indexed as well as named

SImportEmployees.xlsx,2,A1:w25:

Import all of the first (or only) sheet

TImportEmployees.xlsx:

(Standard interface only) Open a dialog to enter the file name and other data

TImport

See Also

Array

ExcelTools

ExcelTools[Export]

ExcelTools[WorkbookData]

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam