Skip to content

Commit e6d8429

Browse files
authored
Doc changes to importing_data (#759)
1 parent 31ae6ca commit e6d8429

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

docs-src/main/userguide/importing_data.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Table of contents
66

7-
[TOC]
7+
[TOC](toc)
88

99
## Supported Formats
1010

@@ -42,9 +42,9 @@ You can create an options object with a builder:
4242
```Java
4343
CsvReadOptions.Builder builder =
4444
CsvReadOptions.builder("myFile.csv")
45-
.separator('\t') // table is tab-delimited
46-
.header(false) // no header
47-
.dateFormat("yyyy.MM.dd"); // the date format to use.
45+
.separator('\t') // table is tab-delimited
46+
.header(false) // no header
47+
.dateFormat("yyyy.MM.dd"); // the date format to use.
4848

4949
CsvReadOptions options = builder.build();
5050

@@ -193,7 +193,9 @@ Table restaurants = Table.read()
193193

194194
It's equally easy to create a table from the results of a database query. In this case, you never need to specify the column types, because they are inferred from the database column types.
195195

196-
Table t = Table.read().db(ResultSet resultSet, String tableName);
196+
```Java
197+
Table t = Table.read().db(ResultSet resultSet, String tableName);
198+
```
197199

198200
Here’s a more complete example that includes the JDBC setup:
199201

@@ -235,6 +237,24 @@ Tablesaw supports importing data from HTML, JSON, and Excel. See the Javadoc for
235237
</dependency>
236238
```
237239

240+
#### Excel
241+
242+
After importing the tablesaw-Excel dependency, you can use the following to read all the sheets in excel.
243+
244+
```Java
245+
XlsxReadOptions options = XlsxReadOptions.builder("<excelFileName>.xlsx").build();
246+
XlsxReader xlsxReader = new XlsxReader();
247+
List<Table> tables= xlsxReader.readMultiple(options);
248+
```
249+
250+
Paricular sheet can be read using `.sheetIndex(int <index>)`:
251+
252+
```Java
253+
XlsxReadOptions options = XlsxReadOptions.builder("<excelFileName>.xlsx").sheetIndex(1).build();
254+
XlsxReader xlsxReader = new XlsxReader();
255+
List<Table> tables= xlsxReader.readMultiple(options);
256+
```
257+
238258
## Exporting data
239259

240260

0 commit comments

Comments
 (0)