版权见水印
require 'luacom'
local excel = luacom . CreateObject( 'Excel.Application' )
excel . Visible = true
local book = excel . Workbooks:Add()
local sheet = book . Worksheets( 1 )
sheet . Name = 'gty'
local range = sheet:Range( 'A1:A10' )
local cell = sheet . Cells( 1 , 1 )
sheet:Range( 'D3:D6' ...
--导入luacom模块
require('luacom')
require('lfs') --导入lfs模块用于取得当前路径,和操作EXCEL无关
local sMainPath = lfs.currentdir() --取得当前路径
--创建EXCEL对象
MyExcel = luacom.CreateObject("Excel.Application") --创建EXCEL对象
--MyExcel = luacom.CreateObject("Ket.Application") --创建WPS表格对象,新版的WPS已经兼容了MSO,就不用这...