0

Please help me to fetch or to read specific cell data of .xls spreed sheet using GemBox in c#.

I am able to write but fails to read the specific cell data.

I don't want to read all data at once.

var dataSet = new DataSet();
        SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY");
        GemBox.Spreadsheet.ExcelFile ef = new GemBox.Spreadsheet.ExcelFile();
       // ExcelFile ef = ExcelFile.Load(@"C:\Users\LENOVO\Documents\100sitesSpreedSheet.xls");
        ef = GemBox.Spreadsheet.ExcelFile.Load(@"C:\Users\LENOVO\Documents\100sitesSpreedSheet.xls");
        ExcelWorksheet ws = ef.Worksheets["100sitesSpreadSheet"];
        ws.Cells[6, 0].Value = "abcd";
        ef.Save(@"C:\Users\LENOVO\Documents\100sitesSpreedSheet.xls");
Matt Ellen
  • 11,268
  • 4
  • 68
  • 90
Vivek Sharma
  • 29
  • 2
  • 12

1 Answers1

0

to read the specific cell's value you can just use the Value property, like the following:

Console.WriteLine(ws.Cells["A7"].Value);

This property is of an object type and can return a text or a number or a date, depending on the data it stores. Also note that GetFormattedValue method actually converts that value into a string representation by using a number format which is applied to that cell.

Mario Z
  • 4,328
  • 2
  • 24
  • 38