Documentation
¶
Overview ¶
Package retroxl is a pure-Go library for generating legacy-compatible XLS files from modern spreadsheet inputs. It converts XLSX, CSV, TSV, and in-memory tabular data into SpreadsheetML-based XLS files that open in Microsoft Excel and pass validation in legacy systems.
RetroXL is designed for integrations where banks, government portals, or older enterprise systems still require `.xls` uploads instead of modern `.xlsx`. The library has no external dependencies and does not rely on LibreOffice, Python, or system binaries.
The API supports converting files from disk or constructing sheets in memory. Output can be written directly to disk, returned as []byte, or streamed to any io.Writer (HTTP response, gRPC, S3 uploads, etc.).
Index ¶
- func ConvertAnyToXLSBytes(inPath string) ([]byte, error)
- func ConvertAnyToXLSFile(inPath, outPath string) error
- func ConvertXLSXToXLSBytes(inPath string) ([]byte, error)
- func ConvertXLSXToXLSFile(inPath, outPath string) error
- func WriteXLSBytes(sheets []Sheet) ([]byte, error)
- func WriteXLSFile(outPath string, sheets []Sheet) error
- func WriteXLSWriter(w io.Writer, sheets []Sheet) error
- type Sheet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertAnyToXLSBytes ¶
ConvertAnyToXLSBytes converts any supported source file on disk to XLS content returned as a byte slice.
func ConvertAnyToXLSFile ¶
ConvertAnyToXLSFile converts any supported source file on disk to an .xls file on disk.
func ConvertXLSXToXLSBytes ¶
ConvertXLSXToXLSBytes converts an .xlsx file on disk to XLS content returned as a byte slice.
func ConvertXLSXToXLSFile ¶
ConvertXLSXToXLSFile converts an .xlsx file on disk to an .xls file on disk.
func WriteXLSBytes ¶
WriteXLSBytes writes one or more sheets and returns the XLS file content as a byte slice.
func WriteXLSFile ¶
WriteXLSFile writes one or more sheets to a file path as XML Spreadsheet 2003 content with a .xls extension.
Types ¶
type Sheet ¶
Sheet represents a single worksheet in a workbook. Headers are optional and, when present, are written as the first row. Each row must have the same length as Headers, if Headers are set.
func CSVToSheets ¶
CSVToSheets reads a delimited text file (CSV or TSV) from the provided path and converts it into a single Sheet. The first row is treated as headers.
func PathToSheets ¶
PathToSheets reads a file from disk and converts it into a slice of Sheet. The conversion is based on the file extension.
Supported extensions:
.xlsx .csv .tsv
func XLSXToSheets ¶
XLSXToSheets reads an .xlsx file from the provided path and converts it into a slice of Sheet.
