Sync MLS Data to Google Sheets Automatically (No Manual Copy-Paste)
Stop copy-pasting new listings. Automatically sync your MLS export emails directly to Google Sheets for unlimited, free data analysis.
You want to run market analysis, but the MLS interface is stuck in 1998. So you export a CSV, open it, copy the rows, and paste them into your "Master Spreadsheet." Every. Single. Morning.
Direct MLS API access costs $200+/month for "RETS/IDX" feeds, and they are nightmare to configure.
The Workaround
Most MLS platforms let you auto-email yourself listings. Set that up, and Apps Script watches for those emails. It grabs the CSV attachment, parses the data, and appends it to your Google Sheet automatically.
The Code: CSV Email Importer
1. Setup
- MLS: Set up a daily auto-search for "New Listings in [Zip Code]". Choose "Export as CSV" if available, or just standard email. (Note: This script assumes a CSV attachment).
- Gmail Label: Create a filter in Gmail to label these emails as
MLS_DATA(and archive them to keep inbox clean).
2. The Script
// CONFIGURATION
const LABEL_NAME = "MLS_DATA";
const SHEET_NAME = "MLS Imports";
function importMLSEmails() {
const label = GmailApp.getUserLabelByName(LABEL_NAME);
if (!label) {
Logger.log("Label not found: " + LABEL_NAME);
return;
}
const threads = label.getThreads();
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(SHEET_NAME);
if (threads.length === 0) return;
// Process threads (oldest first usually better, but here we just process all new)
threads.forEach(thread => {
const messages = thread.getMessages();
messages.forEach(message => {
if (message.isUnread()) {
const attachments = message.getAttachments();
attachments.forEach(attachment => {
if (attachment.getContentType() === "text/csv" || attachment.getName().endsWith(".csv")) {
processCSV(attachment, sheet);
}
});
message.markRead(); // Mark processed
}
});
});
}
function processCSV(attachment, sheet) {
const csvData = Utilities.parseCsv(attachment.getDataAsString());
// Optional: Skip header row if your sheet already has it
// const dataToAppend = csvData.slice(1);
// Loop and append (or filter duplicates based on Listing ID)
if (csvData.length > 0) {
const lastRow = sheet.getLastRow();
// Bulk write is faster than appendRow in loops
sheet.getRange(lastRow + 1, 1, csvData.length, csvData[0].length).setValues(csvData);
}
}3. Set the Trigger
- Extensions > Apps Script.
- Triggers > Add Trigger.
importMLSEmails> Time-driven > Every hour.
Deduplication Logic
The MLS might send the same listing twice. To prevent duplicates:
- Add a helper column
Ain your sheet called "Unique ID" (usually MLS Listing Number). - Before appending, read existing IDs into a
Set(). - Filter
csvDatato exclude IDs already in that Set.
Why This is Powerful
Now you have a live, self-updating database of your market. You can build charts, track "Days on Market" trends, or feed this data into a Looker Studio dashboard-all for $0.
Get more tips like this
Subscribe for practical Google Workspace automation tips.
Free updates. No spam. Unsubscribe any time.
Want more help?
We're here to help. Drop us an email and let's explore how we can optimize your workflows.
Email ushello@mereth.dev