A C library for creating Excel XLSX files.
Find a file
2025-07-01 08:18:13 +01:00
.github zig: update ci version 2025-06-04 20:44:19 +01:00
cocoapods Prep for release 1.1.8. 2024-07-31 23:30:39 +01:00
dev Prep for release 1.2.3. 2025-07-01 00:12:54 +01:00
docs chart: add layout support 2025-03-29 00:46:58 +00:00
examples package: update copyright year 2025-02-11 00:03:36 +00:00
include Prep for release 1.2.3. 2025-07-01 00:12:54 +01:00
lib Initial commit 2014-06-08 17:40:59 +01:00
src workbook: add support for 1904 date epoch 2025-06-29 23:41:01 +01:00
test workbook: add support for 1904 date epoch 2025-06-29 23:41:01 +01:00
third_party minizip: remove c++ comment style from include files 2024-06-23 11:20:41 +01:00
.cirrus.yml Add FreeBSD CI via Cirrus-CI 2024-01-02 09:46:36 +00:00
.gitignore Prep for release 1.2.3. 2025-07-01 00:12:54 +01:00
.indent.pro chart: add layout support 2025-03-29 00:46:58 +00:00
build.zig zig: change from defineCMacro to addCMacro 2025-02-10 21:05:35 +00:00
build.zig.zon zig: update for zig build tools 2025-03-12 08:59:56 +00:00
Changes.txt Prep for release 1.2.3. 2025-07-01 08:18:13 +01:00
CMakeLists.txt build: fix minizip build for cmake 2025-02-26 19:37:02 +00:00
CONTRIBUTING.md Remove TravisCI. 2022-02-13 23:59:53 +00:00
libxlsxwriter.podspec Prep for release 1.2.3. 2025-07-01 00:12:54 +01:00
License.txt package: update copyright year 2025-02-11 00:03:36 +00:00
Makefile build: fix minizip build for cmake 2025-02-26 19:37:02 +00:00
Package.swift Add Swift Package Manager support 2023-01-11 14:11:25 +00:00
Readme.md docs: fix minor issues in data_validate example 2024-06-23 12:00:02 +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.
  • Data validation and dropdown lists.
  • Conditional formatting.
  • Worksheet PNG/JPEG/GIF images.
  • Cell comments.
  • Support for adding Macros.
  • Memory optimization mode for writing large files.
  • Source code available on GitHub.
  • FreeBSD license.
  • ANSI C.
  • Works with GCC, Clang, Xcode, MSVC 2015, ICC, TCC, MinGW, MingGW-w64/32.
  • Works on Linux, FreeBSD, OpenBSD, OS X, iOS and Windows. Also works on MSYS/MSYS2 and Cygwin.
  • Compiles for 32 and 64 bit.
  • Compiles and works on big and little endian systems.
  • 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);

    /* Write 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.