Last active
October 23, 2023 06:06
-
-
Save fileformat-cells-gists/fc5dab52a465a8b5675262c1e91fece3 to your computer and use it in GitHub Desktop.
Getting Cell Values from a Workbook in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (Workbook wb = new Workbook(filePath)) // Load existing spreadsheet/workbook file. | |
{ | |
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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment