Excel Writer v.19

The new feature in version 19 is the possibility to write Excel formulas in the generated spreadsheets.
Simple formulas are supported so far (combinations of numbers, strings, cell references, and combinations of +, -, *, /, &).
See ew_test.adb and excel_out_demo.adb for examples.

For instance, you can write

xl.Write (3, 1, "=A1+A2");

and Excel_Out will convert the text for cell A3 into a genuine Excel formula.

Some advantages:

  • formulas help explaining what a cell’s contents mean
  • generated spreadsheets can be reworked further by humans

Excel Writer (Excel_Out) is a free, standalone, portable, open source package for producing Excel spreadsheets with basic formattings and formulas and page layout.
It can be used in an “Ada.Text_IO” fashion, with Put, Put_Line and New_Line.

Excel Writer can be found via the following links:

Home page: http://excel-writer.sf.net/
Project page: Excel Writer download | SourceForge.net
Mirror: GitHub - zertovitch/excel-writer: Excel Writer: a standalone, portable Ada package for producing Excel spreadsheets
Alire crate: Alire - Excel_writer

Enjoy!

6 Likes

Are there plans to make the formulas symbolic; i.e., something to this effect?

First_Cell := Formula_For_First_Cell;
Second_Cell := Formula_For_Second_Cell;
Xl.Write (3, 1, Formula (Sum (First_Cell, Second_Cell)));

(I’m not saying it’s a good idea. I’m just curious.)

You can already do it with strings:

Xl.Write (3, 1, '=' & First_Cell & '+' & Second_Cell);
1 Like

Cool. I am sometimes asked to provide results in Excel format, but so far, CSV format has been the only alternative :slight_smile:

1 Like

Then, go for Excel_Out!
CSVs can be tedious for human readers, but has its advantages too.
Sometimes I output both formats.

I think I will ditto :slight_smile: