Addons/tables/excel

From J Wiki
Jump to navigation Jump to search
User Guide | Installation | Development | Categories | Git | Build Log

This script reads an excel worksheet using OLE. A worksheet can be read entirely, or in a range, selected by position and size.

It works only in Windows.

Method:

load the excel script, this populates locale cexcel.
call verbs in locale cexcel, e.g.

   load 'tables/excel'
   open_cexcel_ filename

Main definitions:

  open filename              open excel file
  readwss ''                 read worksheet names
  readsheet ''               read the first sheet
  readsheet 'Sales'          read the named sheet
  readsheet 'Sales';range    read range from sheet
  close ''                   close excel

A range is 2 or 4 numbers, xyhw:

x  row position (0 = top row)
y  col position (0 = leftmost column)
h  number of rows
w  number of columns

if range not given, the result is the data available.

If hw is not given or are _, the result is limited to the data available, e.g.

2 5            read all starting from position 2,5
0 5 _1 1       read all of column 5
0 5 _1 3       read columns 5 6 7

The addon has a test script and spreadsheet. Try:

   load '~addons/tables/excel/test0.ijs'

See also Bill Lam's tara package.

Authors

Script developed by Anssi Seppälä and Chris Burke.