When converting spreadsheets, use these properties on ConvertOptions to control the Markdown table output.
Column and row truncation
fromgroupdocs.markdownimportMarkdownConverter,ConvertOptionsdefspreadsheet_truncation():"""Convert a spreadsheet with column and row truncation limits."""# Step 1: Configure column and row limitsoptions=ConvertOptions()options.max_columns=8# only include the first 8 columnsoptions.max_rows=50# only include the first 50 data rows per sheet# Step 2: Convert with truncation options using keyword argumentmd=MarkdownConverter.to_markdown("cost-analysis.xlsx",convert_options=options)# Truncated columns/rows show "..." indicators.# Warnings are reported in ConvertResult.warnings.if__name__=="__main__":spreadsheet_truncation()
cost-analysis.xlsx is sample file used in this example. Click here to download it.
Sheet separator and hidden sheets
fromgroupdocs.markdownimportMarkdownConverter,ConvertOptionsdefspreadsheet_sheets():"""Convert a workbook with custom sheet separators and hidden sheet filtering."""# Step 1: Configure sheet separator and hidden sheet behavioroptions=ConvertOptions()options.sheet_separator="\n---\n"# horizontal rule between worksheetsoptions.include_hidden_sheets=False# skip hidden worksheets (default)# Step 2: Open the workbook with a context managerwithMarkdownConverter("cost-analysis.xlsx")asconverter:# Step 3: Convert using keyword argument for optionsresult=converter.convert(convert_options=options)# Step 4: Check for conversion warnings (e.g., truncation)forwarninginresult.warnings:print(f"Warning: {warning}")# e.g. "Worksheet 'Data' truncated at 50 rows."if__name__=="__main__":spreadsheet_sheets()
cost-analysis.xlsx is sample file used in this example. Click here to download it.
Available options
Property
Type
Default
Description
max_columns
int
0 (unlimited)
Maximum columns per table
max_rows
int
0 (unlimited)
Maximum data rows per worksheet
sheet_separator
str
"\n---\n"
Separator inserted between worksheets
include_hidden_sheets
bool
False
Whether to include hidden worksheets
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.