Use GroupDocs.Markdown to convert XLSX and other spreadsheet files to Markdown tables. You can control how many columns and rows are included using spreadsheet-specific options.
Using static method
The simplest way to convert a spreadsheet file:
importcom.groupdocs.markdown.*;importjava.io.File;publicclassExportSpreadsheetStatic{publicstaticvoidmain(String[]args){// Set license (optional)
if(newFile("GroupDocs.Markdown.lic").exists()){License.set("GroupDocs.Markdown.lic");}// Convert XLSX to Markdown string
Stringmarkdown=MarkdownConverter.toMarkdown("cost-analysis.xlsx");// Or save directly to a file
MarkdownConverter.toFile("cost-analysis.xlsx","export-spreadsheet-static.md");}}
cost-analysis.xlsx is a sample file used in this example. Click here to download it.
For more control, use the instance API. The DocumentConvertOptions class provides spreadsheet-specific setters such as setMaxColumns and setMaxRows to limit the size of the exported tables: