xlscell()

Read(308) Label: excel object, enter, read,

Description:

  Enter cell values to an Excel file object or read values from it.

Syntax:

xo.xlscell(a:b,s ;t)

Note:

The function enters values to Excel sheet s or read values from it. Parameter xo is an Excel file object read in the non-@r@w way.

When parameter t is present, enter string t , separated by the carrige return “\r”(which means the content will be entered into the next row), or tab“\t” (which means the content will be entered into the next column), starting from cell a, and save the entered data using the xlswrite() funtion.

If t is absent, read values from cell a to cell b and return them as a string; if parameter b is absent, read the value of cell a only when the counterpart parameter is a; and read values through to the last cell having a value when the counterpart parameter is a:.

Parameters:

xo

An Excel file object read in a non-@r@w way

a

Cell a

b

Cell b

s

Page number/page name; it is the first page when omitted

t

The to-be-populated string; can be omitted

Options:

@i

Insert a row after the row containing cell a and enter the specified data; by default there won’t be insertion and the existing data will be overwritten

Return value:

No return value or a string

Example:

 

A

 

1

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

Read the Excel file object

2

=A1.xlscell("A1":"C4",1)

Read data from cell A1 to cell C4 on sheet 1 in E2.xlsx, and return it as a string

3

=A1.xlscell("B2","s2")

Read data from cell B2 to the end on sheet s2 in E2.xlsx, and return it as a string

4

=A1.xlscell("A3","s2";"aa\rbb\tcc")

Enter string aa into cell A3 on sheet s2, enter string bb into cell A4 in the next row, and enter string cc into cell B3 in the next column

5

=A1.xlscell@i("A3",;"smile")

smile Insert a row after the one containing cell A4 on sheet 1, which becomes the 4th row, and then enter string smile in it