Export Browse Records to Excel

Good day Forum!!
I am creating a Browse in which they ask me to have a button so that the data from a “List Box” can be exported to “Excel”. But without using any “Template”.
I know it can be done with an OLE Control, but I can’t find any example routine.
If anyone has help or guidance to give me I would appreciate it.
Another caveat, I am not using “MS Office” but the user’s PC has “LibreOffice 7.6” installed.
Any contribution would be appreciated.
A cordial greeting.

I know you said no templates, but you will save yourself HOURS of work and frustration by using capesoft’s product. It’s fast, easy and a seasoned product.



I’ve added “Copy To Clipboard (Excel Friendly)” to my apps before.

If you wanted to construct the string yourself, it’s pretty easy (as long as there are no special characters that need encoding).

Cells are delimited by a TAB character. You can use <9> in your code to represent a TAB.
Rows are delimited by CRLF.

Try something simple first. This is a lot easier with StringTheory, but you could probably use SystemString too.

!OverSimplified Example, but it compiles and you can paste the result into a spreadsheet.

MyCString   CSTRING(HoweverBigYouNeedIt) ! 


  MyCString = 'MyCell1<9>MyCell2<9>MyCell3<13,10>MyCell1.2<9>MyCell2.2<9>MyCell3.2'




You don’t say what version of Clarion you are using? Which Templates ABC or Legacy?

Included with Clarion Legacy is a BrowseToHTML Control template (file CTLHTML.TPW) that puts a button on the Browse that writes an HTML Table of all the Browse records to an HTML file. Excel can open an HTML file. This is an easy way to try the concept.

To avoid using the Template, and allow flexibility, you could use the Template Once to generate the code. Copy/paste the generated code into embeds, then remove the template. Now you can modify the HTML output format, or change it to be CSV, or have both.

If you use ABC you’ll have to make a Legacy version of the Browse to generate the code and try it.


I have a free template that exports data from a list, or a report, to a .csv file.

I can make that available. I think it is for both ABC and Clarion templates?


I’d say SendTo would be the template to use. You add a button and it’s all done. 2 Mins tops.

1 Like

Hello good morning.
Yes, I would be interested if you could provide me with it.
I am working with Clarion 8 EE and using ABC.
A cordial greeting.

Mr. CarlBarnes
Thank you very much for responding and apologies for not clarifying Clarion’s version. I am working with Clarion 8 EE and I use ABC.
I have seen several examples and verified it but without a positive result.
That’s why I wanted to know if, without using a template, I could code a button to export to Excel.
A cordial greeting.

Very true. I use SendTo on most of my browses but only for CSV and email. (Automatic, we don’t give users a choice) Totally forgot it does other formats. Good suggestion.


This code you use to export without using any template. It’s for Excel but maybe you can change some to let it work for LibreOffice.

! Create worksheet and set header
?Ole{PROP:Create} = 'Excel.Application'
?Ole{'Rows(1).Font.Bold'} = True
?Ole{'Columns(1).ColumnWidth'} = 12
?Ole{'Cells(1,1).Value'} = 'Number'
?Ole{'Columns(2).ColumnWidth'} = 30
?Ole{'Cells(1,2).Value'} = 'Name'

! Proces items
LOOP i = 1 TO RECORDS(Customer)
  ?Ole{'Cells('&i&',1).Value'} = CUS:Number
  ?Ole{'Cells('&i&',2).Value'} = CUS:Name

! Open Excel and display the sheet
?Ole{'Application.Visible'} = True
1 Like

Mr PurpleEdge2214
Very grateful for your contribution, I am going to put the Template into practice.
A cordial greeting.

Mr. henkouwejan
Good day.
Thank you very much for his contribution, I’m going to put it into practice. I will be letting you know if you can solve it.

A cordial greeting.

You can try the libxlsxwriter library. There is also a Clarion version. And you don’t need to have Excel installed on your computer.

It should be on this forum too. Please let me know if you can’t find it…

1 Like

Good morning Mr. SerhatSatir
Thank you very much for your recommendation, I will respond to it as soon as possible.
But, I was now able to solve the problem and was able to export to Excel without a template.
A cordial greeting.