Last active
April 28, 2026 11:13
-
-
Save aspose-com-gists/cd1fa352d30f1986497c4cb2d04afd66 to your computer and use it in GitHub Desktop.
How to Perform XBRL to XLSX Conversion using Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from aspose.finance.xbrl import * | |
| import sys | |
| def convert_xbrl_to_xlsx(input_path: str, output_path: str): | |
| try: | |
| # Initialize the XBRL document | |
| xbrl_doc = XbrlDocument(input_path) | |
| # Set conversion options | |
| options = SaveOptions() | |
| options.save_format = SaveFormat.XLSX | |
| # Perform the conversion | |
| xbrl_doc.save(output_path, options) | |
| print(f"Conversion successful: '{output_path}' created.") | |
| except Exception as e: | |
| print(f"Error during conversion: {e}", file=sys.stderr) | |
| raise | |
| if __name__ == "__main__": | |
| INPUT_FILE = "output/sample_report.xbrl" | |
| OUTPUT_FILE = "input/sample_report.xlsx" | |
| convert_xbrl_to_xlsx(INPUT_FILE, OUTPUT_FILE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment