描述:
将Excel对象写入到文件中。
语法:
f.xlswrite(xo,p)
备注:
把Excel对象写入到文件f中,对非@r@w方式读取的Excel对象操作后,需要使用此函数保存。
参数:
|
f |
待写入的Excel文件对象。 |
|
xo |
非@r@w方式读取的Excel对象。 |
|
p |
设置文件f的密码。 |
示例:
将Excel对象写入到新的Excel文件中:
|
|
A |
|
|
1 |
=file("E1.xls").xlsopen() |
读取E1.xls文件,返回excel对象。 |
|
2 |
=file("T2.xls").xlswrite(A1,"123") |
将A1中的excel对象写入到T2.xls文件中,并将T2.xls文件的密码设为123。 |
对Excel对象执行修改计算并保存:
|
|
A |
|
|
1 |
=file("E3.xlsx") |
|
|
2 |
=A1.xlsopen() |
读取E3.xlsx文件,返回excel对象。 |
|
3 |
=demo.query("select * from scores") |
返回序表。 |
|
4 |
=A2.xlsexport@t(A3) |
将A3中的序表中的数据写入到E3.xlsx的第一个sheet页中。 |
|
|
=A2.xlsmove ("Sheet3") |
删除E3.xlsx文件中名为Sheer3的sheet页。 |
|
|
=A1.xlswrite(A2) |
将以上对Excel对象的操作保存到Excel文件中。 |
|
|
>A2.xlsclose() |
关闭Excel对象。 |