As I understand it you are iterating over the Cells in a row and assuming that the first cell you read is in column A, the second in column B and so on?
I suggest that you (parse?) regex the column position / reference from the
DocumentFormat.OpenXml.Spreadsheet.Cell currentcell
currentcell.CellReference
CellReference gives you the cell reference in "A1" notation. Extract the Column part ("A,B,CC,etc.)
You would have to do this for each cell in a row. Then if a cell for a column is missing just fill in a placeholder value. Null or DbNull maybe?
I dont know if there is another way to figure out to what column a cell belongs.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…