|
4 | 4 |
|
5 | 5 | ## Table of contents
|
6 | 6 |
|
7 |
| -[TOC] |
| 7 | +[TOC](toc) |
8 | 8 |
|
9 | 9 | ## Supported Formats
|
10 | 10 |
|
@@ -42,9 +42,9 @@ You can create an options object with a builder:
|
42 | 42 | ```Java
|
43 | 43 | CsvReadOptions.Builder builder =
|
44 | 44 | 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. |
48 | 48 |
|
49 | 49 | CsvReadOptions options = builder.build();
|
50 | 50 |
|
@@ -193,7 +193,9 @@ Table restaurants = Table.read()
|
193 | 193 |
|
194 | 194 | 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.
|
195 | 195 |
|
196 |
| - Table t = Table.read().db(ResultSet resultSet, String tableName); |
| 196 | +```Java |
| 197 | +Table t = Table.read().db(ResultSet resultSet, String tableName); |
| 198 | +``` |
197 | 199 |
|
198 | 200 | Here’s a more complete example that includes the JDBC setup:
|
199 | 201 |
|
@@ -235,6 +237,24 @@ Tablesaw supports importing data from HTML, JSON, and Excel. See the Javadoc for
|
235 | 237 | </dependency>
|
236 | 238 | ```
|
237 | 239 |
|
| 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 | + |
238 | 258 | ## Exporting data
|
239 | 259 |
|
240 | 260 |
|
|
0 commit comments