Skip to content

Instantly share code, notes, and snippets.

Revisions

  1. fileformat-cells-gists revised this gist Oct 23, 2023. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions get-value-from-cell-in-a-workbook.cs
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    using (Workbook wb = new Workbook(filePath))
    using (Workbook wb = new Workbook(filePath)) // Load existing spreadsheet/workbook file.
    {
    Worksheet firstSheet = wb.Worksheets[0];
    Cell cellA1 = firstSheet.Cells["A1"];
    Console.WriteLine(cellA1.GetDataType());
    string value = cellA1.GetValue();
    Worksheet firstSheet = wb.Worksheets[0]; // Load first worksheet within workbook.
    Cell cellA1 = firstSheet.Cells["A1"]; // Get A1 cell object within cellA1 variable.
    Console.WriteLine(cellA1.GetDataType()); // Output cellA1 data type.
    string value = cellA1.GetValue(); // Get value within cell A1.
    Console.WriteLine(value); // Output the value stored in cell A1
    }
  2. fileformat-cells-gists created this gist Oct 23, 2023.
    8 changes: 8 additions & 0 deletions get-value-from-cell-in-a-workbook.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    using (Workbook wb = new Workbook(filePath))
    {
    Worksheet firstSheet = wb.Worksheets[0];
    Cell cellA1 = firstSheet.Cells["A1"];
    Console.WriteLine(cellA1.GetDataType());
    string value = cellA1.GetValue();
    Console.WriteLine(value); // Output the value stored in cell A1
    }