I am using closedXMl to retrieve data from excel into my C# WPF. I am using the Range()
function to manually select a range for data retrieval.
How can I get the values in the cells and store them into a list? Is there a way to work around this? Below is a sample of the method that I created to retrieve and store the excel data.
public List<double> TableList = new List<double>();
public void test()
{
using (var excelWorkbook = new XLWorkbook(@"D:\OneDrive ExcelFile.xlsx"))
{
var Ws = excelWorkbook.Worksheet("Sheet1");
var TableList = Ws.Range("O18:O31");
}
for (int i = 0; i < TableList.Count; i++)
{
Console.WriteLine("{0}", TableList[i]);
}
}
The output I get is Sheet1!O18:O31