sashka/xlsxio-zig
A thin XLSX I/O wrapper for Zig
2.7.1
1.11.2
Only the read functionality of XLSX I/O is wrapped here since I only need to read XLSX files.
const xlsxio = @import("xlsxio");
pub fn main() !void {
const allocator = std.heap.page_allocator;
// Open an XLSX file
var reader = try xlsxio.Reader.open(allocator, "data.xlsx");
defer reader.close();
// Open the first sheet
var sheet = try reader.openSheet(null, .{});
defer sheet.close();
// Read all rows and cells
while (sheet.nextRow()) {
while (sheet.nextCell()) |cell| {
std.debug.print("{s}\t", .{cell});
xlsxio.free(cell);
}
std.debug.print("\n", .{});
}
}
I use this package as part of a project source tree like "/pkg/xlsxio", so my build.zig.zon
looks like this:
.dependencies = .{
.xlsxio = .{
.path = "pkg/xlsxio",
},
},
The main types are:
Reader
- for opening and managing XLSX filesSheet
- for reading worksheet dataSheetList
- for enumerating worksheetsMIT License, same as the underlying XLSX I/O library.