# readtable

Creates a table object from `data`, which is an Excel-compatible file. readtable is available only on Windows
systems where Microsoft Excel is installed.

## Syntax

t = readtable(data)

t = readtable(data, 'Sheet', wsheet)

t = readtable(data, 'Range', range)

t = readtable(data, 'Sheet', wsheet, 'Range', range)

## Inputs

`data`- Name of the file to read. The file extension must be Excel compatible.
`wsheet`(optional)- Specifies the worksheet name or number. The default worksheet read is the first one if no argument is specified. If only two arguments are used and the second string argument does not contain a ':', it is considered to be the worksheet name.
`range`(optional)- Specifies the range where the data needs to read from. Range should be in an Excel- compatible format, with a ':'.

## Outputs

- t
- t is a table object. The size of the table object will match that of the data read from the file. Only numeric and string values are supported.

## Examples

Create a table from an Excel file with defaults:

```
t = table({'A',1,2; 'B',3,4; 'C',5,6});
writetable(t, 'test.xlsx', 'Sheet', 2);
t = readtable('test.xlsx', 'Sheet', 2)
```

```
'A' 1 2
'B' 3 4
'C' 5 6
```

Create a table from an Excel file with worksheet number specified:

```
t = table({'A',1,2; 'B',3,4; 'C',5,6});
writetable(t, 'test.xlsx', 'Sheet', 2);
t = readtable('test.xlsx', 'Sheet', 2, 'Range', 'A1:C3'))
```

```
'A' 1 2
'B' 3 4
'C' 5 6
```

Create a table from an Excel file with worksheet name, range and all outputs specified:

```
t = table({'A',1,2; 'B',3,4; 'C',5,6});
writetable(t, 'test.xlsx', 'Sheet', 2);
t = readtable('test.xlsx', 'Range', 'A1:C3', 'Sheet', 2)
```

```
'A' 1 2
'B' 3 4
'C' 5 6
```