diff --git a/frictionless/formats/excel/__spec__/test_control.py b/frictionless/formats/excel/__spec__/test_control.py index 27aac29135..a6b2573445 100644 --- a/frictionless/formats/excel/__spec__/test_control.py +++ b/frictionless/formats/excel/__spec__/test_control.py @@ -6,3 +6,20 @@ def test_excel_dialect(): with Resource("data/table.xlsx") as resource: assert isinstance(resource.dialect.get_control("excel"), formats.ExcelControl) + +def test_excel_control_to_copy(): + """ + Test that the ExcelControl and all its attributes are correctly copied + """ + # Make a control with all values changed from the defaults + control_with_changed_attributes = formats.ExcelControl( + sheet="non-default", + fill_merged_cells=True, + preserve_formatting=True, + adjust_floating_point_error=True, + stringified=True + ) + + control_copy = control_with_changed_attributes.to_copy() + + assert control_copy == control_with_changed_attributes diff --git a/frictionless/formats/excel/control.py b/frictionless/formats/excel/control.py index 015fc2c9ea..298a2faa3e 100644 --- a/frictionless/formats/excel/control.py +++ b/frictionless/formats/excel/control.py @@ -51,6 +51,12 @@ class ExcelControl(Control): """ Stringifies all the cell values. Default value is False. + + Note that a table resource schema will still be applied and types coerced to match the schema + (either provided or inferred) _after_ the rows are read as strings. + + To return all cells as strings then both set `stringified=True` and specify a + schema that defines all fields to be of type string (see #1659). """ # Metadata @@ -61,5 +67,6 @@ class ExcelControl(Control): "fillMergedCells": {"type": "boolean"}, "preserveFormatting": {"type": "boolean"}, "adjustFloatingPointError": {"type": "boolean"}, + "stringified": {"type": "boolean"}, }, }