remove_properties method

remove_properties

Removes metadata properties satisfying the specified predicate.

def remove_properties(self, predicate):
    ...
Parameter Type Description
predicate Func[MetadataProperty, bool] A function to test each metadata property for a condition.

Returns: int: The number of affected properties.

Example

from groupdocs.metadata import Metadata

with Metadata("input.xlsx") as metadata:
    removed = metadata.remove_properties(
        lambda p: p.name is not None and ("Revision" in p.name or "LastPrinted" in p.name)
    )
    print(f"Properties removed: {removed}")
    metadata.save("output.xlsx")

See Also