Autofit column in ClosedXML.Excel
Your cells don’t have any contents. Therefore AdjustToContents() won’t have any effect.
Your cells don’t have any contents. Therefore AdjustToContents() won’t have any effect.
To access a row: var row = ws1.Row(3); To check if the row is empty: bool empty = row.IsEmpty(); To access a cell (column) in a row: var cell = row.Cell(3); To get the value from a cell: object value = cell.Value; // or string value = cell.GetValue<string>(); For more information see the documentation.