You can use something like this to get column C, for example:
var numberOfRows = sheet.UsedRange.Columns[3, Type.Missing].Rows.Count; var values = sheet.Range["C1:C" + numberOfRows].Value2;
numberOfRows contains the number of lines on the sheet (I think it does not skip empty lines at the top, not sure). After that, you select a range from C1 to CN and get Value2, which contains the values. Keep in mind that an array of values ββis actually a two-dimensional array. Now you can easily execute a for loop to get the elements:
for (int i = 1; i <= values.Length; i++){ sb.Append(values[i, 1] + " "); }
This can be optimized if the columns are next to each other and such, but the above code should start working.
source share