xlsopen()

Read(2828) Label: read, excel file,

Description:

Read an Excel file and return an Excel file object.

Syntax:

f.xlsopen(p)

Note:

The function reads Excel file f and returns an Excel file object, which can saved as a read-only table sequence. The returned Excel file object include three properties: stname (page name), nrows (number of rows) and ncols ( number of columns). When f is large, use @r and @w options to retrieve data from it.

Parameter:

f

An Excel file

p

The password for opening an Excel file; can be omitted if no password is set for the to-be-opened file

Option:

@r

Read data in a stream style; support only xlsx files

@w

Write data in a stream style; doesn’t support returning the index and support only xlsx files; the option and @r option are mutually exclusive

Return value:

Excel file object

Example:

 

A

 

1

=file("D:/ex1.xls")

 

2

=A1.xlsopen("123")

Read the xls file whose password is 123.

3

=file("ex2.xlsx").xlsopen()

Read the xlsx file without a password.