📊 Cross-platform user-friendly xlsx library for C++11+
Go to file
2014-05-19 20:47:25 -04:00
build a little cleanup 2014-05-14 18:48:18 -04:00
docs/samples initial commit 2014-05-06 17:28:38 -04:00
source most tests : fixed! 2014-05-19 20:47:15 -04:00
third-party almost finished 2014-05-14 18:31:48 -04:00
.clang-format initial commit 2014-05-06 17:28:38 -04:00
.gitattributes initial commit 2014-05-06 17:28:38 -04:00
.gitignore a little cleanup 2014-05-14 18:48:18 -04:00
.gitmodules fix submodules 2014-05-16 00:17:54 -04:00
README.md Show how to include xlnt 2014-05-19 17:37:00 -04:00

xlnt

Introduction

xlnt is a c++ library that reads and write XLSX files. The API is roughly based on openpyxl, a python XLSX library. It is still very much a work in progress, but I expect the basic functionality to be working in the near future.

Usage

Using xlnt in your project

#include <xlnt.h>

Create a new spreadsheet

xlnt::workbook wb;
xlnt::worksheet ws = wb.get_active_sheet();
ws.cell("A1") = 5;
ws.cell("B2") = "string data";
ws.cell("C3") = "=RAND()";
ws.merge_cells("C3:C4");
ws.freeze_panes("B2");
wb.save("book1.xlsx");

Open an existing spreadsheet

xlnt::workbook wb2;
wb2.load("book2.xlsx");
wb2["sheet1"].get_dimensions();
for(auto &row : wb2["sheet2"])
{
    for(auto cell : row)
    {
        std::cout << cell.to_string() << std::endl;
    }
}

Building

It compiles in all of the major compilers. Currently it is being built in GCC 4.8.2, MSVC 12, and Clang 3.3.

Workspaces for Visual Studio, XCode, and GNU Make can be created using premake and the premake5.lua file in the build directory.

Dependencies

xlnt requires the following libraries:

License

xlnt is currently released under the terms of the MIT License:

Copyright (c) 2014 Thomas Fussell

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.