Skip to content

Commit a239e2a

Browse files
Updated documentation
1 parent ea3c9c3 commit a239e2a

1 file changed

Lines changed: 35 additions & 6 deletions

File tree

README-V2.md

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,17 +342,46 @@ var excelImporter = MiniExcel.Importers.GetOpenXmlImporter();
342342
var sheetNames = excelImporter.GetSheetNames(path);
343343
```
344344

345-
#### 6. Get the columns' names from an Excel sheet
345+
#### 6. Get the columns' names from an Excel worksheet
346346

347347
```csharp
348348
var excelImporter = MiniExcel.Importers.GetOpenXmlImporter();
349349
var columns = excelImporter.GetColumnNames(path);
350350

351351
// columns = [ColumnName1, ColumnName2, ...] when there is a header row
352352
// columns = ["A","B",...] otherwise
353+
354+
```
355+
#### 7. Retrieve Comments from an Excel worksheet
356+
357+
You can extract threaded comments and their replies from an Excel workbook using the `RetrieveComments` method:
358+
359+
```csharp
360+
var excelImporter = MiniExcel.Importers.GetOpenXmlImporter();
361+
var comments = excelImporter.RetrieveComments(path, sheetName: "Sheet1").Comments;
362+
363+
foreach (var comment in comments)
364+
{
365+
Console.WriteLine($"Cell: {comment.CellAddress}");
366+
Console.WriteLine($"{comment.CreatedAt:yy-MM-dd HH:mm} - {comment.Author.DisplayName}: {comment.Text}");
367+
foreach (var reply in comment.Replies)
368+
{
369+
Console.WriteLine($"{reply.CreatedAt:yy-MM-dd HH:mm} - {reply.Author.DisplayName}: {reply.Text}");
370+
}
371+
}
372+
```
373+
374+
You can similarly also retrieve notes:
375+
```csharp
376+
var notes = excelImporter.RetrieveComments(path, sheetName: "Sheet1").Notes;
377+
foreach (var note in notes)
378+
{
379+
Console.WriteLine($"Cell: {note.CellAddress}");
380+
Console.WriteLine($"{note.Author.DisplayName}: {note.Text}");
381+
}
353382
```
354383

355-
#### 7. Casting dynamic rows to IDictionary
384+
#### 8. Casting dynamic rows to IDictionary
356385

357386
Under the hood the dynamic objects returned in a query are implemented using `ExpandoObject`,
358387
making it possible to cast them to `IDictionary<string,object>`:
@@ -370,7 +399,7 @@ foreach(IDictionary<string,object> row in excelImporter.Query(path))
370399
}
371400
```
372401

373-
#### 8. Query Excel sheet as a DataTable
402+
#### 9. Query Excel worksheet as a DataTable
374403

375404
This is not recommended, as `DataTable` will forcibly load all data into memory, effectively losing the advantages MiniExcel offers.
376405

@@ -379,15 +408,15 @@ var excelImporter = MiniExcel.Importers.GetOpenXmlImporter();
379408
var table = excelImporter.QueryAsDataTable(path);
380409
```
381410

382-
#### 9. Specify what cell to start reading data from
411+
#### 10. Specify what cell to start reading data from
383412

384413
```csharp
385414
var excelImporter = MiniExcel.Importers.GetOpenXmlImporter();
386415
excelImporter.Query(path, startCell: "B3")
387416
```
388417
![image](https://user-images.githubusercontent.com/12729184/117260316-8593c400-ae81-11eb-9877-c087b7ac2b01.png)
389418

390-
#### 10. Fill Merged Cells
419+
#### 11. Fill Merged Cells
391420

392421
If the Excel sheet being queried contains merged cells it is possble to enable the option to fill every row with the merged value.
393422

@@ -410,7 +439,7 @@ Filling of cells with variable width and height is also supported
410439
>Note: The performance will take a hit when enabling the feature.
411440
>This happens because in the OpenXml standard the `mergeCells` are indicated at the bottom of the file, which leads to the need of reading the whole sheet twice.
412441
413-
#### 11. Big files and disk-based cache
442+
#### 12. Big files and disk-based cache
414443

415444
If the SharedStrings file size exceeds 5 MB, MiniExcel will default to use a local disk cache.
416445
E.g: on the file [10x100000.xlsx](https://github.com/MiniExcel/MiniExcel/files/8403819/NotDuplicateSharedStrings_10x100000.xlsx) (one million rows of data), when disabling the disk cache the maximum memory usage is 195 MB, but with disk cache enabled only 65 MB of memory are used.

0 commit comments

Comments
 (0)