Use fpspreadsheet; you can install it via the Online-Package-Manager. There's lots of documentation in the wiki:https://wiki.lazarus.freepascal.org/FPSpreadsheethttps://wiki.lazarus.freepascal.org/FPSpreadsheet:_Exampleshttps://wiki.lazarus.freepascal.org/FPSpreadsheet:_List_of_formulashttps://wiki.lazarus.freepascal.org/FPSpreadsheet_tutorial:_Writing_a_mini_spreadsheet_applicationhttps://wiki.lazarus.freepascal.org/TsWorksheetGridTo get you started I am attaching a simple demo which exports a stringgrid to xlsx (or LibreOffice ods if you uncomment the corresponding line). The demo assumes that there are specific data types in each column and converts the strings of the StringGrid to corresponding types so that the xlsx file contains real numbers or dates rather than strings.
All cases
please help or guide me