天软金融分析.NET函数大全 > 文档处理函数 > Excel处理函数 > Excel处理函数-txlsreadwrite版

ExcelGetCell2    

简述

  获得指定的Excel中的指定的Sheet的行列的数据值,
  注:此函数无需依赖office/wps,但需要关闭文件。
定义
ExcelGetCell2(ExcelFileName:String;ExcelSheetName:String;Row:Integer;Col:Integer;Value:Any):Integer
参数
名称类型说明
ExcelFileNameString字符串,Excel文件名
ExcelSheetNameString字符串,Sheet名
RowInteger整数,指定行
ColInteger整数,指定列
ValueAny任意类型,返回指定行列的值
返回Integer 整数。如果成功则返回真,如果指定的文件不存在或者指定的Sheet不存在或者失败则返回假。
  • 范例

    //取本地文件C:\VBA.xlsx第一行第一列的数据
      dir:="C:\\VBA.xlsx";
      sheet:="Sheet1";
      ret:=rdo2 ExcelGetCell2(dir,sheet,1,1,v);
      if ret then
      begin
        return v;
      end;
      return 0;
相关