A C library for creating Excel XLSX files.
Find a file
2016-05-28 16:05:23 +01:00
dev/release Added link generator for examples. 2016-05-23 20:06:15 +01:00
docs Updated docs on using MSVC to compile on Windows. 2016-05-28 16:05:23 +01:00
examples Additional chart docs. 2016-05-23 22:42:27 +01:00
include Fixes for MSVC warnings. 2016-05-24 20:24:09 +01:00
lib Initial commit 2014-06-08 17:40:59 +01:00
src Fix memory leak. 2016-05-25 01:23:51 +01:00
test Tests for chart sizing. 2016-05-21 21:30:15 +01:00
third_party/minizip Remove define causing warning on MSVC. 2016-05-25 22:43:54 +01:00
.gitignore Additional tests for insert_image(). 2016-01-02 00:14:44 +00:00
.indent.pro Initial working chart titles. 2016-05-15 20:18:51 +01:00
.travis.yml TravisCI config file. 2015-04-16 23:55:17 +01:00
Changes.txt Prep for release 0.3.3. 2016-05-23 23:09:03 +01:00
CONTRIBUTING.md Renamed new_workbook() to workbook_new(). 2016-01-04 19:48:16 +00:00
libxlsxwriter.podspec Prep for release 0.3.3. 2016-05-23 23:09:03 +01:00
LICENSE.txt Update copyright year. 2016-01-03 19:47:16 +00:00
Makefile Prep for release 0.3.3. 2016-05-23 23:09:03 +01:00
Readme.md Prep for release 0.3.3. 2016-05-23 23:09:03 +01:00

libxlsxwriter

Libxlsxwriter: A C library for creating Excel XLSX files.

demo image

The libxlsxwriter library

Libxlsxwriter is a C library that can be used to write text, numbers, formulas and hyperlinks to multiple worksheets in an Excel 2007+ XLSX file.

It supports features such as:

  • 100% compatible Excel XLSX files.
  • Full Excel formatting.
  • Merged cells.
  • Defined names.
  • Autofilters.
  • Charts.
  • Worksheet PNG/JPEG images.
  • Memory optimization mode for writing large files.
  • Source code available on GitHub.
  • FreeBSD ref license.
  • ANSI C.
  • Works with GCC 4.x, GCC 5.x, Clang, Xcode, MSVC 2015, ICC and TCC.
  • Works on Linux, FreeBSD, OS X, iOS and Windows.
  • The only dependency is on zlib.

Here is an example that was used to create the spreadsheet shown above:

#include "xlsxwriter.h"

int main() {

    /* Create a new workbook and add a worksheet. */
    lxw_workbook  *workbook  = workbook_new("demo.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    /* Add a format. */
    lxw_format *format = workbook_add_format(workbook);

    /* Set the bold property for the format */
    format_set_bold(format);

    /* Change the column width for clarity. */
    worksheet_set_column(worksheet, 0, 0, 20, NULL);

    /* Write some simple text. */
    worksheet_write_string(worksheet, 0, 0, "Hello", NULL);

    /* Text with formatting. */
    worksheet_write_string(worksheet, 1, 0, "World", format);

    /* Writer some numbers. */
    worksheet_write_number(worksheet, 2, 0, 123,     NULL);
    worksheet_write_number(worksheet, 3, 0, 123.456, NULL);

    /* Insert an image. */
    worksheet_insert_image(worksheet, 1, 2, "logo.png");

    workbook_close(workbook);

    return 0;
}

See the full documentation for the getting started guide, a tutorial, the main API documentation and examples.