ExcelMapper
ExcelMapper copied to clipboard
How Handling Missing Excel Headers in Model Mapping?
I had a problem. When I want to map an Excel to a model, and Excel is missing a some header or colum, the mapping will be error.
How can I solve this problem?
there is sample:
hasFinish = !sheet.TryReadRow(out ChargesModelRow row);
public partial record ChargesModelRow : IEqualityYieldCompare
{
...
[ExcelColumnIndex(15)]
public IEnumerable<CriteriaEnum> Criteria { get; set; } = new List<CriteriaEnum>();
public PaymentTypeEnum? PaymentType { get; set; }
public Guid? GroupId { get; init; } = null;
"
For example, in this case, I added GroupId in ChargesModelRow, but if excel does not exist this colum, will be error . How can I solve this problem?