V library for reading and writing Microsoft Excel files.
30
stars
57
commits
V
primary language
Aug 20, 2026
updated
A package in pure V for reading and writing Excel files in the XLSX format.
v install https://github.com/hungrybluedev/xlsx
Take the data.xlsx file from the examples/01_marksheet directory for this example.
import xlsx
fn main() {
workbook := xlsx.Document.from_file('data.xlsx')!
println('[info] Loaded ${workbook.sheets.len} worksheets.')
sheet1 := workbook.sheets[1]
dataset := sheet1.get_all_data()!
println('Row count: ${dataset.row_count()}')
for row in dataset.raw_data {
println(row.join(', '))
}
}
Replace 'data.xlsx' with the actual path to your file.
For a more detailed example, see examples/01_marksheet/marks.v.
import xlsx
import time
fn main() {
mut doc := xlsx.Document.new()
sheet_id := doc.add_sheet('Sheet1')
mut sheet := doc.get_sheet_mut(sheet_id) or { return }
sheet.set_cell(xlsx.Location.from_encoding('A1')!, 'Name')
sheet.set_cell(xlsx.Location.from_encoding('B1')!, 'Score')
sheet.set_number(xlsx.Location.from_encoding('B2')!, 95)
sheet.set_number_f64(xlsx.Location.from_encoding('B3')!, 87.5)
jan_1_2026 := time.Time{
year: 2026
month: 1
day: 1
}
sheet.set_date(xlsx.Location.from_encoding('C2')!, jan_1_2026)
sheet.set_formula(xlsx.Location.from_encoding('B4')!, 'SUM(B2:B3)')
sheet.set_currency(xlsx.Location.from_encoding('D2')!, 1234.56, .usd)
doc.to_file('output.xlsx')!
}
For more examples including background fills and styled formulas, see the spec/ directory.
#xlsx channel about your ideas and what you want to do.This project is licensed under the MIT License. See LICENSE for more details.
If you like this project, please check out Set Theory for Beginners or read a few articles on the Coders' Compass website.
V
100.0%
V library for reading and writing Microsoft Excel files.
30
stars
57
commits
V
primary language
Aug 20, 2026
updated
A package in pure V for reading and writing Excel files in the XLSX format.
v install https://github.com/hungrybluedev/xlsx
Take the data.xlsx file from the examples/01_marksheet directory for this example.
import xlsx
fn main() {
workbook := xlsx.Document.from_file('data.xlsx')!
println('[info] Loaded ${workbook.sheets.len} worksheets.')
sheet1 := workbook.sheets[1]
dataset := sheet1.get_all_data()!
println('Row count: ${dataset.row_count()}')
for row in dataset.raw_data {
println(row.join(', '))
}
}
Replace 'data.xlsx' with the actual path to your file.
For a more detailed example, see examples/01_marksheet/marks.v.
import xlsx
import time
fn main() {
mut doc := xlsx.Document.new()
sheet_id := doc.add_sheet('Sheet1')
mut sheet := doc.get_sheet_mut(sheet_id) or { return }
sheet.set_cell(xlsx.Location.from_encoding('A1')!, 'Name')
sheet.set_cell(xlsx.Location.from_encoding('B1')!, 'Score')
sheet.set_number(xlsx.Location.from_encoding('B2')!, 95)
sheet.set_number_f64(xlsx.Location.from_encoding('B3')!, 87.5)
jan_1_2026 := time.Time{
year: 2026
month: 1
day: 1
}
sheet.set_date(xlsx.Location.from_encoding('C2')!, jan_1_2026)
sheet.set_formula(xlsx.Location.from_encoding('B4')!, 'SUM(B2:B3)')
sheet.set_currency(xlsx.Location.from_encoding('D2')!, 1234.56, .usd)
doc.to_file('output.xlsx')!
}
For more examples including background fills and styled formulas, see the spec/ directory.
#xlsx channel about your ideas and what you want to do.This project is licensed under the MIT License. See LICENSE for more details.
If you like this project, please check out Set Theory for Beginners or read a few articles on the Coders' Compass website.
V
100.0%