import groupdocs.redaction as gr
import groupdocs.redaction.options as gro
import groupdocs.redaction.redactions as grr
# Set your EMAIL regex pattern and replacement text
repl_opt = grr.ReplacementOptions(color)
emailRegex = "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}"
redaction = grr.RegexRedaction(emailRegex, repl_opt)
# Open the document you want to clean
with gr.Redactor("source.xslx") as redactor:
# Apply redaction rules
result = redactor.apply(redaction)
# Save your redacted file
so = gro.SaveOptions()
so.add_suffix = True
so.rasterize_to_pdf = False
result_path = redactor.save(so)