Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fileformat-cells-gists/fc5dab52a465a8b5675262c1e91fece3 to your computer and use it in GitHub Desktop.
Save fileformat-cells-gists/fc5dab52a465a8b5675262c1e91fece3 to your computer and use it in GitHub Desktop.
Getting Cell Values from a Workbook in C#
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