# Get supported file formats This article explains how to obtain supported file formats list when parsing documents with GroupDocs.Parser within your Python applications. [GroupDocs.Parser](https://products.groupdocs.com/parser/python-net) allows you to get the list of all [supported file formats]({{< ref "parser/python-net/getting-started/supported-document-formats.md" >}}). To do this, follow these steps: 1. Call the `get_supported_file_types` method of the `FileType` class 2. Enumerate through the collection of `FileType` objects The following code snippet shows how to obtain a list of supported file formats: ## Get all supported file formats {{< tabs "example-1" >}} {{< tab "Python" >}} ```python from groupdocs.parser.options import FileType # Get all supported file types supported_file_types = FileType.get_supported_file_types() # Iterate through the collection for file_type in sorted(supported_file_types, key=lambda x: x.extension): print(f"{file_type.extension} - {file_type.file_format}") print(f"\nTotal supported formats: {len(supported_file_types)}") ``` {{< /tab >}} {{< tab "get-all-supported-file-formats.txt" >}} ```text .7z - 7z Archive File .azw3 - AZW3 .bmp - Bitmap Image File .bz2 - Bzip2 Archive File .chm - Compiled HTML Help File .csv - Comma Separated Values File .doc - Microsoft Word Document .docm - Word Open XML Macro-Enabled Document .docx - Microsoft Word Open XML Document .dot - Word Document Template [TRUNCATED] ``` [Download full output](https://docs.groupdocs.com/parser/python-net/_output_files/developer-guide/basic-usage/get-supported-file-formats/example-1/get-all-supported-file-formats.txt) {{< /tab >}} {{< /tabs >}} ## Filter supported formats by category You can filter supported formats based on your needs: {{< tabs "example-2" >}} {{< tab "Python" >}} ```python from groupdocs.parser.options import FileType # Get all supported file types supported_file_types = FileType.get_supported_file_types() # Define format categories word_formats = [".doc", ".docx", ".docm", ".dot", ".dotx", ".dotm", ".odt", ".ott", ".rtf"] excel_formats = [".xls", ".xlsx", ".xlsm", ".xlsb", ".xlt", ".xltx", ".xltm", ".ods"] pdf_formats = [".pdf"] print("Word Processing Formats:") for file_type in supported_file_types: if file_type.extension.lower() in word_formats: print(f" {file_type.extension} - {file_type.file_format}") print("Spreadsheet Formats:") for file_type in supported_file_types: if file_type.extension.lower() in excel_formats: print(f" {file_type.extension} - {file_type.file_format}") print("PDF Formats:") for file_type in supported_file_types: if file_type.extension.lower() in pdf_formats: print(f" {file_type.extension} - {file_type.file_format}") ``` {{< /tab >}} {{< tab "filter-supported-formats-by-category.txt" >}} ```text Word Processing Formats: .doc - Microsoft Word Document .dot - Word Document Template .docx - Microsoft Word Open XML Document .docm - Word Open XML Macro-Enabled Document .dotx - Word Open XML Document Template .dotm - Word Open XML Macro-Enabled Document Template .odt - OpenDocument Text Document .ott - OpenDocument Document Template .rtf - Rich Text Format File [TRUNCATED] ``` [Download full output](https://docs.groupdocs.com/parser/python-net/_output_files/developer-guide/basic-usage/get-supported-file-formats/example-2/filter-supported-formats-by-category.txt) {{< /tab >}} {{< /tabs >}} ## Check if a specific format is supported You can check if a particular file format is supported: {{< tabs "example-3" >}} {{< tab "Python" >}} ```python from groupdocs.parser.options import FileType def is_format_supported(extension): """Check if a file format is supported by GroupDocs.Parser""" supported_file_types = FileType.get_supported_file_types() for file_type in supported_file_types: if file_type.extension.lower() == extension.lower(): return True return False # Check various formats formats_to_check = [".pdf", ".docx", ".xlsx", ".txt", ".unknown"] for ext in formats_to_check: if is_format_supported(ext): print(f"{ext} - Supported") else: print(f"{ext} - Not Supported") ``` {{< /tab >}} {{< tab "is-format-supported.txt" >}} ```text .pdf - Supported .docx - Supported .xlsx - Supported .txt - Supported .unknown - Not Supported ``` [Download full output](https://docs.groupdocs.com/parser/python-net/_output_files/developer-guide/basic-usage/get-supported-file-formats/is_format_supported/is-format-supported.txt) {{< /tab >}} {{< /tabs >}} ## Get format details You can retrieve detailed information about each supported format: {{< tabs "example-4" >}} {{< tab "Python" >}} ```python from groupdocs.parser.options import FileType # Get all supported file types supported_file_types = FileType.get_supported_file_types() # Display format details print("Supported Document Formats:\n") print(f"{'Extension':<12} {'Format Name':<50}") print("-" * 62) for file_type in sorted(supported_file_types, key=lambda x: x.extension): print(f"{file_type.extension:<12} {file_type.file_format:<50}") ``` {{< /tab >}} {{< tab "get-format-details.txt" >}} ```text Supported Document Formats: Extension Format Name -------------------------------------------------------------- .7z 7z Archive File .azw3 AZW3 .bmp Bitmap Image File .bz2 Bzip2 Archive File .chm Compiled HTML Help File .csv Comma Separ [TRUNCATED] ``` [Download full output](https://docs.groupdocs.com/parser/python-net/_output_files/developer-guide/basic-usage/get-supported-file-formats/example-4/get-format-details.txt) {{< /tab >}} {{< /tabs >}} ## Practical usage example Here's a practical example of validating user input: {{< tabs "example-5" >}} {{< tab "Python" >}} ```python import os from groupdocs.parser import Parser from groupdocs.parser.options import FileType def process_file(file_path): """Process a file if its format is supported""" # Get file extension _, ext = os.path.splitext(file_path) # Check if format is supported supported_file_types = FileType.get_supported_file_types() is_supported = any(ft.extension.lower() == ext.lower() for ft in supported_file_types) if not is_supported: print(f"Error: File format '{ext}' is not supported") return False # Process the file with Parser(file_path) as parser: doc_info = parser.get_document_info() print(f"Processing: {file_path}") print(f"Format: {doc_info.file_type.file_format}") print(f"Pages: {doc_info.page_count}") # Extract text text_reader = parser.get_text() if text_reader is None: print("Text extraction isn't supported for this format") return False text = text_reader.read_to_end() print(f"Text extraction successful: {len(text)} characters") return True # Example usage process_file("sample.pdf") process_file("sample.docx") ``` {{< /tab >}} {{< tab "sample.pdf" >}} {{< tab-text >}} The following sample file is used in this example: [sample.pdf](https://docs.groupdocs.com/parser/python-net/_sample_files/developer-guide/basic-usage/get-supported-file-formats/sample.pdf) {{< /tab-text >}} {{< /tab >}} {{< tab "sample.docx" >}} {{< tab-text >}} The following sample file is used in this example: [sample.docx](https://docs.groupdocs.com/parser/python-net/_sample_files/developer-guide/basic-usage/get-supported-file-formats/sample.docx) {{< /tab-text >}} {{< /tab >}} {{< tab "process-file.txt" >}} ```text Processing: sample.pdf Format: Portable Document Format File Pages: 4 Text extraction successful: 4570 characters Processing: sample.docx Format: Microsoft Word Open XML Document Pages: 2 Text extraction successful: 2584 characters ``` [Download full output](https://docs.groupdocs.com/parser/python-net/_output_files/developer-guide/basic-usage/get-supported-file-formats/process_file/process-file.txt) {{< /tab >}} {{< /tabs >}} ## More resources ### Advanced usage topics To learn more about document data extraction features, please refer to the [advanced usage section]({{< ref "parser/python-net/developer-guide/advanced-usage/_index.md" >}}). ### GitHub examples You may find more code examples in our GitHub repository: * [GroupDocs.Parser for Python via .NET examples](https://github.com/groupdocs-parser/GroupDocs.Parser-for-Python-via-.NET) ### Free online document parser Along with the full-featured library, we provide a free online document parser app. You are welcome to extract data from PDF, DOCX, XLSX, and more with our [Free Online Document Parser App](https://products.groupdocs.app/parser).