Exporting metadata properties

This example demonstrates how to export metadata properties to an Excel workbook. The ExportManager constructor takes a list of MetadataProperty objects, so collect the properties you want (here, the whole tree via find_properties) and wrap the result in list(...). ExportFormat also supports CSV, JSON and XML.

from groupdocs.metadata import Metadata
from groupdocs.metadata.export import ExportManager, ExportFormat


def exporting_metadata_properties():
    with Metadata("input.pdf") as metadata:
        # Collect the whole metadata tree as a list of properties
        properties = list(metadata.find_properties(lambda p: True))

        # Export them to an Excel workbook
        ExportManager(properties).export("export.xlsx", ExportFormat.XLSX)
        print(f"Exported {len(properties)} properties to export.xlsx")


if __name__ == "__main__":
    exporting_metadata_properties()

input.pdf is the sample file used in this example. Click here to download it.

Binary file (XLSX, 9 KB)

Download full output

See also

More resources

GitHub examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free online document metadata management App

You are welcome to view and edit metadata of PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, emails, images and more with our free online Free Online Document Metadata Viewing and Editing App.