Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save aspose-com-gists/cd1fa352d30f1986497c4cb2d04afd66 to your computer and use it in GitHub Desktop.

Select an option

Save aspose-com-gists/cd1fa352d30f1986497c4cb2d04afd66 to your computer and use it in GitHub Desktop.
How to Perform XBRL to XLSX Conversion using Python
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