当前位置: 首页 > news >正文

wps excel js编程

定义全局变量

 const a = "dota"
function test()
{Debug.Print(a)
}

在这里插入图片描述

获取表格中单元格内容

function test()
{Debug.Print("第一行第二列",Cells(1,2).Text)Debug.Print("A1:",Range("A1").Text)
}

在这里插入图片描述

写单元格

Range("C1").Value2 = "qwerb"//把C1单元格写入qwerb

遍历表格

function a()
{var r = Range("A1:C2")for( i of r){Debug.Print(i.Text)}
}

在这里插入图片描述

遍历文件夹下excel文件并打开

//注意写路径的时候要用\\进行转义否则会报错,文件夹路径最后也要写两个\否则无法打开文件
const path = "E:\\T\\"
function test()
{var fileName = Dir(path + "*.xlsx")//此处用*.xlsx来过滤excel文件,也可以用其他的表达式来过滤文件,字符串的组合可以用+来串联//如果想指定某个文件打开可以直接写成	Workbooks.Open("E:/T/新建 XLSX 工作表 (3).xlsx", undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true);while(fileName != ""){Debug.Print(fileName)Workbooks.Open(path + fileName, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true);fileName = Dir()}
}

在这里插入图片描述

http://www.lryc.cn/news/204925.html

相关文章:

  • Python 类继承解释
  • Reactor反应器模式
  • alibaba.fastjson的使用(六) -- JavaBean==》Json字符串、JSONObject、JSONArray
  • uniapp 自定义导航栏
  • 查分小程序:一键查询成绩,班主任和家长的得力助手
  • Linux内核驱动开发的步骤
  • 【Java 进阶篇】HTML DOM 事件详解
  • redis 从小白到大师系列
  • vue使用.filter方法检索数组中指定时间段内的数据
  • Ubuntu 安装 npm 和 node
  • Matlab论文插图绘制模板第122期—函数折线图(fplot)
  • IK分词器如何修改支持跨版本ES
  • Spring MVC常用十大注解
  • 二、【MyBatis】 MyBatis入门与简单使用
  • 基于DF模式的协作通信技术matlab性能仿真
  • Angular-01:基本架构
  • 字符串划分
  • ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.9‘ not found的解决方法
  • 华为云全新上线Serverless应用中心,支持一键构建文生图应用
  • scrapy的安装和使用
  • Kotlin中的异常处理
  • [Ubuntu 18.04] 搭建文件夹共享之Samba服务器
  • 设计模式-装饰器模式
  • 【Vs code调试C++】
  • 使用 C++创建一个简易的数据库管理系统 (DBMS)
  • 简单了解一下:NodeJS的WebSocket网络编程
  • 目标检测技术概述
  • 软件设计原则-开闭原则讲解以及代码示例
  • 分类预测 | MATLAB实现SSA-CNN-GRU-Attention数据分类预测(SE注意力机制)
  • LeetCode--180 连续出现的数字