1

这听起来很简单(我敢肯定),但我无法弄清楚如何做到这一点:我在 excel 的表格中有数据 - 假设有两列:A 列包含 ID,B 列包含电子邮件地址。

我正在寻找一个 Applescript,它将打开数据库文件并在其中一列中查找 ID,但返回第二列的值供我稍后在脚本的其余部分中使用。

这是我迄今为止所拥有的:

set theFile to POSIX path of (choose file with prompt "Choose File to Operate on")
tell application "Microsoft Excel"
activate
open theFile
set searchRange to range ("A1:D2")
try
    set foundRange to find searchRange what "ID1" with match case
    (* do something with the foundRange *)
on error -- not found
    (* do error handling *)
end try
end tell

不知道如何获取第二列并将该值返回给 ie。设置为IDEmail?

4

1 回答 1

1

尝试:

tell application "Microsoft Excel"
    set searchRange to range ("A1:A5")
    set foundRange to find searchRange what "ID3" with match case
    set fRow to first row index of foundRange
    set myData to value of range ("B" & fRow as text)
    (* do something with the foundRange *)
end tell

在此处输入图像描述

于 2012-12-05T22:06:44.277 回答