lights FAQ Forum github.com/luapower/xlsxwriter

Data Exchange
base64
cjson
msgpack
expat
genx
csv
xlsxwriter

xlsxwriter

Excel XLSX file generator


local xlsxwriter = require'xlsxwriter'

Xlsxwriter is a Lua module that can be used to write text, numbers, formulas and hyperlinks to multiple worksheets in an Excel 2007+ XLSX file.

Features

  • High degree of fidelity with files produced by Excel.
  • Can write very large files with semi-constant memory.
  • Full formatting.
  • Merged cells.
  • Worksheet setup methods.
  • Defined names.
  • Document properties.

Limitations

  • It can only create new files. It cannot read or modify existing files.

Status

Xlsxwriter was written by John McNamara and published here. The module is no longer maintained by the original author. This fork is maintained by Cosmin Apreutesei.

Xlsxwriter is a Lua port of the Perl Excel::Writer::XLSX and the Python XlsxWriter modules.

Example

local Workbook = require "xlsxwriter.workbook"

local workbook  = Workbook:new("demo.xlsx")
local worksheet = workbook:add_worksheet()

-- Widen the first column to make the text clearer.
worksheet:set_column("A:A", 20)

-- Add a bold format to use to highlight cells.
local bold = workbook:add_format({bold = true})

-- Write some simple text.
worksheet:write("A1", "Hello")

-- Text with formatting.
worksheet:write("A2", "World", bold)

-- Write some numbers, with row/column notation.
worksheet:write(2, 0, 123)
worksheet:write(3, 0, 123.456)

workbook:close()

Last updated: 4 years ago | Edit on GitHub

Package:xlsxwriter
Pkg type:Lua+ffi
Version: v0.0.6-29-g434ee37
Last commit:
Author: John McNamara
License: MIT

Requires: minizip2  luajit 

Required by: none


Top