Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc changes to importing_data #759

Merged
merged 3 commits into from
Feb 17, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "updated formatting, corrected link and added example for exce…
…l reading"

This reverts commit 36c0112.
  • Loading branch information
R1j1t committed Feb 15, 2020
commit bf5656fb084b0f5a68ab7d5c1d9bb03f2736f66a
30 changes: 5 additions & 25 deletions docs/userguide/importing_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Table of contents

[TOC](toc)
[TOC]

## Supported Formats

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

CsvReadOptions options = builder.build();

Expand Down Expand Up @@ -193,9 +193,7 @@ Table restaurants = Table.read()

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.

```Java
Table t = Table.read().db(ResultSet resultSet, String tableName);
```
Table t = Table.read().db(ResultSet resultSet, String tableName);

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

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

#### Excel

After importing the tablesaw-Excel dependency, you can use the following to read all the sheets in excel.

```Java
XlsxReadOptions options = XlsxReadOptions.builder("<excelFileName>.xlsx").build();
XlsxReader xlsxReader = new XlsxReader();
List<Table> tables= xlsxReader.readMultiple(options);
```

Paricular sheet can be read using `.sheetIndex(int <index>)`:

```Java
XlsxReadOptions options = XlsxReadOptions.builder("<excelFileName>.xlsx").sheetIndex(1).build();
XlsxReader xlsxReader = new XlsxReader();
List<Table> tables= xlsxReader.readMultiple(options);
```

## Exporting data


Expand Down