I have a Google Sheets that look like this...
My goal is to get certain email in my Gmail account and extract the data in the email and populate column C with the matching value from Column A.
This is the sample email body...
New status update for your shipment!
Tracking No. JK5SD8F4M6
Items Product A
Status At Warehouse 2
Following the tutorial from https://youtu.be/gdgCVqtcIw4 , I manage to extract the data and append to a new row in the sheet using this function.
function extractDetails(message){
var emailData = {
body: "Null",
date: "Null",
trackingno: "Null",
}
emailData.date = message.getDate();
emailData.body = message.getPlainBody();
emailData.trackingno = emailData.body.match(/(?<=Tracking No. ).*/).toString().trim();
var activeSheet = SpreadsheetApp.getActiveSpreadsheet();
activeSheet.getSheetByName('Sheet1').appendRow([emailData.trackingno, emailData.date]);
}
However, this function only add the data into a new row.
How do I make it so that it finds the matching tracking number on column A and fill in the date on corresponding cell in column C?
