저는 VBA를 능숙하게 사용했지만 이전에는 Google Script로 무언가를하려하고 있습니다. 그리고 나는 정말 진실로 붙어 있습니다.Google Apps Script로 이메일 구문 분석, 정규식 문제가 있습니까?
기본적으로 Gmail의 표준 전자 메일에서 데이터를 추출하여 Google 시트에 넣으려고합니다. 제가 지금까지 상담 한 주제에 몇 가지 다른 스레드가 있습니다. 전자 메일의 본문을 시트로 가져올 수는 있지만 구문 분석 할 수는 없습니다. (이 전에했던, 그래서 누군가가 이유를 제안 할 수 있다면 감사 드리겠습니다 내가 정규식에 새로운 오전
내가 구글 스크립트에도 새로운 오전, 심지어 디버거는 이제 작동이 중지 것 같습니다 이것은).
function processInboxToSheet() {
var label = GmailApp.getUserLabelByName("NEWNOPS");
var threads = label.getThreads();
// Set destination sheet
var sheet = SpreadsheetApp.getActiveSheet();
// Get all emails labelled NEWNOPS
for (var i = 0; i < threads.length; i++) {
var tmp,
message = threads[i].getMessages()[1], // second message in thread
content = message.getPlainBody(); // remove html markup
if (content) {
// search email for 'of:' and capure next line of text as address
// tests OK at regex101.com
property = content.match(/of:[\n]([^\r\n]*)[\r\n]/);
// if no match, display error
var property = (tmp && tmp[1]) ? tmp[1].trim() : 'No property';
sheet.appendRow([property]);
} // End if
// remove label to avoid duplication
threads[i].removeLabel(label)
} // End for loop
}
내가 좋아 시트에 '콘텐츠'를 추가 할 수 있지만 정규식에서 요구하는 주소 텍스트를 추출 할 수 없습니다 :
여기 내 기본적인 기능입니다. 내용 다음과 같이 표시됩니다 :
123 모든 거리, 아무도시, AN1 1AN
DATE : 2017년 5월 5일
가격 : £ 241,000
판매자의 세부 사항의 구매
NOPS을
NAME : 읽기 부인 판매자는
감사합니다 :)