I'm using LinqToExcel to read an excel file. Everything works fine, but it the content of a cell is a hyperlink, I only get the hyperlink text. I would like to get its URL/email.
try
{
// Connection to the DB
iRentDB db = new iRentDB();
// Get excel file and work sheet
string pathToExcelFile = @"Members_Export_1500068180.xls";
string sheetName = "Members_Export_1500068180";
var excelFile = new LinqToExcel.ExcelQueryFactory(pathToExcelFile);
// Select all rows from Excel
var rows = from c in excelFile.WorksheetNoHeader(sheetName)
select c;
foreach (var row in rows)
{
// Get and validate the email
var email = row[8].Value.ToString();
}
}catch (Exception any)
{
Console.Write(any.ToString());
}
The cell I'm reading is a hyperlink. The cell content name is "Email" and the hyperlink value is test@test.com. On my C# code, the variable email = "Email". How can I set to the variable email the hyperlink value ("test@test.com")?
Thanks