excel.setCells
Description
Set a range of cells from a 2D array.

Parameters
bookID number
worksheetIndex number
startX number
startY number
cells 2D array (in format cells[yRow][xCol])

Return value
success boolean

Example
local xl = excel.load("c:\\test.xls")
if xl < 1 then
    print("Error loading workbook")
else

    local cells = data.createGrid()

    -- add 2 cells to start of first row
    data.setCell(cells, 0, 0, "Hello")
    data.setCell(cells, 1, 0, "World")

    -- add cells to first worksheet
    setCells(xl, 0, 1, 1, cells)

    -- save the workbook
    excel.save()

    -- close the workbook
    excel.close(xl)
end if

Comments
startX and startY cell coordinates are 1 based.

See also
setCells
getCell
setCell

Back
Generated on the 26 June 2024 at 22:01:28 (UK Time)