ClosedXML read from excel file

Nate Pet

I have an excel file. I simply need a cell value. I am having a hard time finding documentation on this. I have done ClosedXML before where I write date to an excel file but not where I read from it.

      const string fileName = 
                    @"C:\Folder1\Form.xlsx";

        // Retrieve the value in cell A1.
         var workbook1 = new XLWorkbook(fileName);
         var ws1 = workbook1.Worksheet(1);

Any help would be appreciated.

Raidri supports Monica

There are multiple possibilities to get a cell and its value depending on the data type:

var cell = ws.Cell("A1");
var cell = ws.Cell(1, 2);                 // row 1, column 2

object result = cell.Value;
string result = cell.Value.ToString();    // if you want to get text
string result = cell.GetValue<string>();  // also for text
int result = cell.GetValue<int>();        // for integer numbers

And more for other datatypes.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Reading from Excel File using ClosedXML

From Dev

Append to excel file with ClosedXML

From Dev

Downloading excel file from web api using closedxml

From Dev

ClosedXML: Export To Excel not downloading the File MVC 4

From Dev

How to count number of columns Excel file in ClosedXML?

From Dev

Open and read from excel file

From Dev

Open and read from excel file

From Dev

Read from excel file error

From Dev

Read data from excel file Laravel Excel

From Dev

Read Image From Excel File Using NPOI

From Dev

Java POI - read date from Excel file

From Dev

Read data from Excel file in Selenium Java

From Dev

Read Image From Excel File Using NPOI

From Dev

How to read the excel file from cloud or server?

From Dev

Read RDF/XML file from website in Excel

From Dev

How to append a new row to an Excel file using C# and ClosedXML?

From Dev

Error while saving modified excel(xlsx) file with ClosedXML

From Dev

Is it more efficient to read from an Excel file or an CSV file?

From Dev

File.ReadAllLines() fails to read from a file that is opened by Excel

From Dev

Download file with ClosedXML

From Dev

Read limited number of rows from excel file in R with read_excel

From Java

Read Excel File in Python

From Dev

Read remote Excel file

From Java

Error when trying to read excel file from web site

From Dev

Openpyxl - How to read int value from cells in excel file

From Dev

Read data from a table in .MDB file into Excel 2013 with VBA

From Dev

How to read specific rows from excel file using pandas

From Dev

using Pandas to read in excel file from URL - XLRDError

From Dev

can not read last column data from excel file

Related Related

HotTag

Archive