A C library for creating Excel XLSX files.
Find a file
Hans Wennborg 1dfd55bf17 Reject overflows of zip header fields in minizip.
This checks the lengths of the file name, extra field, and comment
that would be put in the zip headers, and rejects them if they are
too long. They are each limited to 65535 bytes in length by the zip
format. This also avoids possible buffer overflows if the provided
fields are too long.

(cherry picked from commit 73331a6a0481067628f065ffe87bb1d8f787d10c)
2023-12-24 23:27:09 +00:00
.github zig: add current release version 2023-12-12 23:27:15 +00:00
cmake Fix cmake minizip version check. 2023-08-03 01:09:18 +01:00
cocoapods Prep for release 1.1.4. 2021-10-09 14:44:36 +01:00
dev/release Added memory buffer example to the docs. 2022-11-12 18:03:22 +00:00
docs Add support for signed VBA projects. 2023-09-20 19:41:21 +01:00
examples Convert public char* to const char* for C++ compatibility. 2023-09-25 20:59:05 +01:00
include minizip: update include files for v1.3 2023-11-18 14:22:18 +00:00
lib Initial commit 2014-06-08 17:40:59 +01:00
src Convert public char* to const char* for C++ compatibility. 2023-09-25 20:59:05 +01:00
test Upgrade ctest.h to latest version. 2023-09-25 23:43:06 +01:00
third_party Reject overflows of zip header fields in minizip. 2023-12-24 23:27:09 +00:00
.gitignore zig build 2023-05-12 12:31:43 +01:00
.indent.pro Added support for adding a macro button to a worksheet. 2021-08-26 23:44:22 +01:00
build.zig zig: use cached include_files 2023-12-12 23:27:15 +00:00
build.zig.zon full-support 2023-08-02 23:24:46 +01:00
Changes.txt Prep for release 1.1.5. 2022-12-30 15:25:10 +00:00
CMakeLists.txt Upgrade ctest.h to latest version. 2023-09-25 23:43:06 +01:00
CONTRIBUTING.md Remove TravisCI. 2022-02-13 23:59:53 +00:00
libxlsxwriter.podspec Prep for release 1.1.5. 2022-12-30 15:25:10 +00:00
License.txt Fix typo. 2022-06-09 20:27:58 +01:00
Makefile Convert public char* to const char* for C++ compatibility. 2023-09-25 20:59:05 +01:00
Package.swift Add Swift Package Manager support 2023-01-11 14:11:25 +00:00
Readme.md Update readme. 2022-08-10 15:40: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.
  • Data validation and drop down 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.