在单元格中搜索术语
Searching for a term in a cell
我正在尝试将我的银行余额号码从电子邮件中提取到 Google Spreadsheets 中。到目前为止,我有一个 Google 脚本抓取电子邮件,然后将其粘贴到原始内容形式的 Google spreadsheet 中。您可以在下面看到正在粘贴的 RawContent。 (这不是我的银行余额或卡,它是一个模板,已被使用并从我的银行网站上取下,用于制作电子邮件的草稿。)
MIME-Version: 1.0
Received: by 10.79.112.196 with HTTP; Tue, 20 Oct 2015 18:13:30 -0700 (PDT)
Date: Wed, 21 Oct 2015 02:13:30 +0100
Delivered-To: liamnagle5@gmail.com
Message-ID: <CAL9nrMo3OXzMsPUMpXjOO1AEg_u72czoYLEQLeWz emRfJ0tfw@mail.gmail.com>
Subject: BB TEST
From: Liam Nagle <liamnagle5@gmail.com>
To: Liam Nagle <liamnagle5@gmail.com>
Content-Type: multipart/alternative; boundary=001a114d944e1c2fac052293164b
--001a114d944e1c2fac052293164b
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Dear Mr. Broe,
Your weekly account summary for
account ending 6920 is below:
Current Balance as at 12:30 26 Sep:
=C2=A32500.00+
Available Balance as at 12:30 26 Sep:
=C2=A32700.00+
RECENT TRANSACTIONS:
25Sep Transfer =C2=A310.59-
25Sep Cheque deposit 150.00+
24Sep Direct Debit =C2=A33.60-
23Sep Standing order =C2=A323.50-
21Sep CC payment =C2=A349.00-
Regards,
Santander Alerts
--001a114d944e1c2fac052293164b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><span style=3D"color:rgb(102,102,102);font-family:Verdana,=
Arial,Helvetica,sans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-=
height:17.9952px">Dear Mr. Broe,</span><br style=3D"margin:0px;color:rgb(10=
2,102,102);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px=
;letter-spacing:-0.1104px;line-height:17.9952px"><br style=3D"margin:0px;co=
lor:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,sans-serif;font-si=
ze:11.04px;letter-spacing:-0.1104px;line-height:17.9952px"><span style=3D"c=
olor:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,sans-serif;font-s=
ize:11.04px;letter-spacing:-0.1104px;line-height:17.9952px">Your weekly acc=
ount summary for</span><br style=3D"margin:0px;color:rgb(102,102,102);font-=
family:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px;letter-spacing:=
-0.1104px;line-height:17.9952px"><span style=3D"color:rgb(102,102,102);font=
-family:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px;letter-spacing=
:-0.1104px;line-height:17.9952px">account ending 6920 is below:</span><br s=
tyle=3D"margin:0px;color:rgb(102,102,102);font-family:Verdana,Arial,Helveti=
ca,sans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-height:17.995=
2px"><br style=3D"margin:0px;color:rgb(102,102,102);font-family:Verdana,Ari=
al,Helvetica,sans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-hei=
ght:17.9952px"><span style=3D"color:rgb(102,102,102);font-family:Verdana,Ar=
ial,Helvetica,sans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-he=
ight:17.9952px">Current Balance as at 12:30 26 Sep:=C2=A0</span><br style=
=3D"margin:0px;color:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,s=
ans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-height:17.9952px"=
><span style=3D"color:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,=
sans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-height:17.9952px=
">=C2=A32500.00+</span><br style=3D"margin:0px;color:rgb(102,102,102);font-=
family:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px;letter-spacing:=
-0.1104px;line-height:17.9952px"><span style=3D"color:rgb(102,102,102);font=
-family:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px;letter-spacing=
:-0.1104px;line-height:17.9952px">Available Balance as at 12:30 26 Sep:=C2=
=A0</span><br style=3D"margin:0px;color:rgb(102,102,102);font-family:Verdan=
a,Arial,Helvetica,sans-serif;font-size:11.04px;letter-spacing:-0.1104px;lin=
e-height:17.9952px"><span style=3D"color:rgb(102,102,102);font-family:Verda=
na,Arial,Helvetica,sans-serif;font-size:11.04px;letter-spacing:-0.1104px;li=
ne-height:17.9952px">=C2=A32700.00+</span><br style=3D"margin:0px;color:rgb=
(102,102,102);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11.0=
4px;letter-spacing:-0.1104px;line-height:17.9952px"><br style=3D"margin:0px=
;color:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,sans-serif;font=
-size:11.04px;letter-spacing:-0.1104px;line-height:17.9952px"><span style=
=3D"color:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,sans-serif;f=
ont-size:11.04px;letter-spacing:-0.1104px;line-height:17.9952px">RECENT TRA=
NSACTIONS:</span><br style=3D"margin:0px;color:rgb(102,102,102);font-family=
:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px;letter-spacing:-0.110=
4px;line-height:17.9952px"><span style=3D"color:rgb(102,102,102);font-famil=
y:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px;letter-spacing:-0.11=
04px;line-height:17.9952px">25Sep Transfer =C2=A310.59-</span><br style=3D"=
margin:0px;color:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,sans-=
serif;font-size:11.04px;letter-spacing:-0.1104px;line-height:17.9952px"><sp=
an style=3D"color:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,sans=
-serif;font-size:11.04px;letter-spacing:-0.1104px;line-height:17.9952px">25=
Sep Cheque deposit 150.00+</span><br style=3D"margin:0px;color:rgb(102,102,=
102);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px;lette=
r-spacing:-0.1104px;line-height:17.9952px"><span style=3D"color:rgb(102,102=
,102);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px;lett=
er-spacing:-0.1104px;line-height:17.9952px">24Sep Direct Debit =C2=A33.60-<=
/span><br style=3D"margin:0px;color:rgb(102,102,102);font-family:Verdana,Ar=
ial,Helvetica,sans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-he=
ight:17.9952px"><span style=3D"color:rgb(102,102,102);font-family:Verdana,A=
rial,Helvetica,sans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-h=
eight:17.9952px">23Sep Standing order =C2=A323.50-</span><br style=3D"margi=
n:0px;color:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,sans-serif=
;font-size:11.04px;letter-spacing:-0.1104px;line-height:17.9952px"><span st=
yle=3D"color:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,sans-seri=
f;font-size:11.04px;letter-spacing:-0.1104px;line-height:17.9952px">21Sep C=
C payment =C2=A349.00-</span><br style=3D"margin:0px;color:rgb(102,102,102)=
;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px;letter-sp=
acing:-0.1104px;line-height:17.9952px"><br style=3D"margin:0px;color:rgb(10=
2,102,102);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px=
;letter-spacing:-0.1104px;line-height:17.9952px"><span style=3D"color:rgb(1=
02,102,102);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11.04p=
x;letter-spacing:-0.1104px;line-height:17.9952px">Regards,</span><br style=
=3D"margin:0px;color:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,s=
ans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-height:17.9952px"=
><br style=3D"margin:0px;color:rgb(102,102,102);font-family:Verdana,Arial,H=
elvetica,sans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-height:=
17.9952px"><span style=3D"color:rgb(102,102,102);font-family:Verdana,Arial,=
Helvetica,sans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-height=
:17.9952px">Santander Alerts</span></div>
--001a114d944e1c2fac052293164b--
我希望从中得到的是它所说的:
Current Balance as at 12:30 26 Sep:
=C2=A32500.00+
Available Balance as at 12:30 26 Sep:
=C2=A32700.00+
我想从这里提取数字 2500.00
和 2700.00
。 =C2=A3
部分表示以 RawContent 形式编写的 £
。提取这两个数字后,我希望将它们分配给另一个 sheet 上的两个单元格,然后使用该数据制定财务计划等
您可以使用公式 =REGEXEXTRACT(E4,"=C2=A3(\d+\.\d{2})\+")
获得第一个匹配项,但第二个匹配项会有点棘手。
由于您已经在使用脚本,我将编写另一个快速函数来提取这些值。
function getBalance(){
var data = SpreadsheetApp.getActiveSheet().getRange(1,1).getValue();
var re = /=C2=A3(\d+\.\d{2})\+/g;
var results = [re.exec(data)[1], re.exec(data)[1]];
return results;
}
这将获取文本,通过使用原始 £ 前缀和 return 在数组中识别它们来提取两个可用余额。
然后您甚至可以 运行 =GETBALANCE()
来自电子表格,它会在两个单独的行中为您提供余额输出。
我正在尝试将我的银行余额号码从电子邮件中提取到 Google Spreadsheets 中。到目前为止,我有一个 Google 脚本抓取电子邮件,然后将其粘贴到原始内容形式的 Google spreadsheet 中。您可以在下面看到正在粘贴的 RawContent。 (这不是我的银行余额或卡,它是一个模板,已被使用并从我的银行网站上取下,用于制作电子邮件的草稿。)
MIME-Version: 1.0
Received: by 10.79.112.196 with HTTP; Tue, 20 Oct 2015 18:13:30 -0700 (PDT)
Date: Wed, 21 Oct 2015 02:13:30 +0100
Delivered-To: liamnagle5@gmail.com
Message-ID: <CAL9nrMo3OXzMsPUMpXjOO1AEg_u72czoYLEQLeWz emRfJ0tfw@mail.gmail.com>
Subject: BB TEST
From: Liam Nagle <liamnagle5@gmail.com>
To: Liam Nagle <liamnagle5@gmail.com>
Content-Type: multipart/alternative; boundary=001a114d944e1c2fac052293164b
--001a114d944e1c2fac052293164b
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Dear Mr. Broe,
Your weekly account summary for
account ending 6920 is below:
Current Balance as at 12:30 26 Sep:
=C2=A32500.00+
Available Balance as at 12:30 26 Sep:
=C2=A32700.00+
RECENT TRANSACTIONS:
25Sep Transfer =C2=A310.59-
25Sep Cheque deposit 150.00+
24Sep Direct Debit =C2=A33.60-
23Sep Standing order =C2=A323.50-
21Sep CC payment =C2=A349.00-
Regards,
Santander Alerts
--001a114d944e1c2fac052293164b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><span style=3D"color:rgb(102,102,102);font-family:Verdana,=
Arial,Helvetica,sans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-=
height:17.9952px">Dear Mr. Broe,</span><br style=3D"margin:0px;color:rgb(10=
2,102,102);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px=
;letter-spacing:-0.1104px;line-height:17.9952px"><br style=3D"margin:0px;co=
lor:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,sans-serif;font-si=
ze:11.04px;letter-spacing:-0.1104px;line-height:17.9952px"><span style=3D"c=
olor:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,sans-serif;font-s=
ize:11.04px;letter-spacing:-0.1104px;line-height:17.9952px">Your weekly acc=
ount summary for</span><br style=3D"margin:0px;color:rgb(102,102,102);font-=
family:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px;letter-spacing:=
-0.1104px;line-height:17.9952px"><span style=3D"color:rgb(102,102,102);font=
-family:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px;letter-spacing=
:-0.1104px;line-height:17.9952px">account ending 6920 is below:</span><br s=
tyle=3D"margin:0px;color:rgb(102,102,102);font-family:Verdana,Arial,Helveti=
ca,sans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-height:17.995=
2px"><br style=3D"margin:0px;color:rgb(102,102,102);font-family:Verdana,Ari=
al,Helvetica,sans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-hei=
ght:17.9952px"><span style=3D"color:rgb(102,102,102);font-family:Verdana,Ar=
ial,Helvetica,sans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-he=
ight:17.9952px">Current Balance as at 12:30 26 Sep:=C2=A0</span><br style=
=3D"margin:0px;color:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,s=
ans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-height:17.9952px"=
><span style=3D"color:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,=
sans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-height:17.9952px=
">=C2=A32500.00+</span><br style=3D"margin:0px;color:rgb(102,102,102);font-=
family:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px;letter-spacing:=
-0.1104px;line-height:17.9952px"><span style=3D"color:rgb(102,102,102);font=
-family:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px;letter-spacing=
:-0.1104px;line-height:17.9952px">Available Balance as at 12:30 26 Sep:=C2=
=A0</span><br style=3D"margin:0px;color:rgb(102,102,102);font-family:Verdan=
a,Arial,Helvetica,sans-serif;font-size:11.04px;letter-spacing:-0.1104px;lin=
e-height:17.9952px"><span style=3D"color:rgb(102,102,102);font-family:Verda=
na,Arial,Helvetica,sans-serif;font-size:11.04px;letter-spacing:-0.1104px;li=
ne-height:17.9952px">=C2=A32700.00+</span><br style=3D"margin:0px;color:rgb=
(102,102,102);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11.0=
4px;letter-spacing:-0.1104px;line-height:17.9952px"><br style=3D"margin:0px=
;color:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,sans-serif;font=
-size:11.04px;letter-spacing:-0.1104px;line-height:17.9952px"><span style=
=3D"color:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,sans-serif;f=
ont-size:11.04px;letter-spacing:-0.1104px;line-height:17.9952px">RECENT TRA=
NSACTIONS:</span><br style=3D"margin:0px;color:rgb(102,102,102);font-family=
:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px;letter-spacing:-0.110=
4px;line-height:17.9952px"><span style=3D"color:rgb(102,102,102);font-famil=
y:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px;letter-spacing:-0.11=
04px;line-height:17.9952px">25Sep Transfer =C2=A310.59-</span><br style=3D"=
margin:0px;color:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,sans-=
serif;font-size:11.04px;letter-spacing:-0.1104px;line-height:17.9952px"><sp=
an style=3D"color:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,sans=
-serif;font-size:11.04px;letter-spacing:-0.1104px;line-height:17.9952px">25=
Sep Cheque deposit 150.00+</span><br style=3D"margin:0px;color:rgb(102,102,=
102);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px;lette=
r-spacing:-0.1104px;line-height:17.9952px"><span style=3D"color:rgb(102,102=
,102);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px;lett=
er-spacing:-0.1104px;line-height:17.9952px">24Sep Direct Debit =C2=A33.60-<=
/span><br style=3D"margin:0px;color:rgb(102,102,102);font-family:Verdana,Ar=
ial,Helvetica,sans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-he=
ight:17.9952px"><span style=3D"color:rgb(102,102,102);font-family:Verdana,A=
rial,Helvetica,sans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-h=
eight:17.9952px">23Sep Standing order =C2=A323.50-</span><br style=3D"margi=
n:0px;color:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,sans-serif=
;font-size:11.04px;letter-spacing:-0.1104px;line-height:17.9952px"><span st=
yle=3D"color:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,sans-seri=
f;font-size:11.04px;letter-spacing:-0.1104px;line-height:17.9952px">21Sep C=
C payment =C2=A349.00-</span><br style=3D"margin:0px;color:rgb(102,102,102)=
;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px;letter-sp=
acing:-0.1104px;line-height:17.9952px"><br style=3D"margin:0px;color:rgb(10=
2,102,102);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11.04px=
;letter-spacing:-0.1104px;line-height:17.9952px"><span style=3D"color:rgb(1=
02,102,102);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11.04p=
x;letter-spacing:-0.1104px;line-height:17.9952px">Regards,</span><br style=
=3D"margin:0px;color:rgb(102,102,102);font-family:Verdana,Arial,Helvetica,s=
ans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-height:17.9952px"=
><br style=3D"margin:0px;color:rgb(102,102,102);font-family:Verdana,Arial,H=
elvetica,sans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-height:=
17.9952px"><span style=3D"color:rgb(102,102,102);font-family:Verdana,Arial,=
Helvetica,sans-serif;font-size:11.04px;letter-spacing:-0.1104px;line-height=
:17.9952px">Santander Alerts</span></div>
--001a114d944e1c2fac052293164b--
我希望从中得到的是它所说的:
Current Balance as at 12:30 26 Sep:
=C2=A32500.00+
Available Balance as at 12:30 26 Sep:
=C2=A32700.00+
我想从这里提取数字 2500.00
和 2700.00
。 =C2=A3
部分表示以 RawContent 形式编写的 £
。提取这两个数字后,我希望将它们分配给另一个 sheet 上的两个单元格,然后使用该数据制定财务计划等
您可以使用公式 =REGEXEXTRACT(E4,"=C2=A3(\d+\.\d{2})\+")
获得第一个匹配项,但第二个匹配项会有点棘手。
由于您已经在使用脚本,我将编写另一个快速函数来提取这些值。
function getBalance(){
var data = SpreadsheetApp.getActiveSheet().getRange(1,1).getValue();
var re = /=C2=A3(\d+\.\d{2})\+/g;
var results = [re.exec(data)[1], re.exec(data)[1]];
return results;
}
这将获取文本,通过使用原始 £ 前缀和 return 在数组中识别它们来提取两个可用余额。
然后您甚至可以 运行 =GETBALANCE()
来自电子表格,它会在两个单独的行中为您提供余额输出。