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
contains these dependencies:
.dependencies = .{
.xlsxio = .{
.path = "pkg/xlsxio",
},
.expat = .{
.url = "git+https://github.com/allyourcodebase/libexpat.git#2.7.1",
.hash = "libexpat-2.7.1-y_akI1M7AAA1huPJVegH4dosRVA-lMRgzMuX9vC7aB1s",
},
.libzip = .{
.url = "git+https://github.com/allyourcodebase/libzip.git#1.11.2",
.hash = "libzip-1.11.2-WX_L8Ck4AADFFAXJ5QvIrrZ9osNgIQJWPgih_6rg8K97",
},
},
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.