A property project's website needs to show which units are available, reserved or sold. The people who know are in sales, and they live in a spreadsheet. If every status change needs a developer or a WordPress login, the website falls behind.
Here's a pattern that keeps a WordPress floor-plan map in sync with a Google Sheet, with no Google API, OAuth consent screen or API keys.
Serve the sheet as a CSV
A Google Sheet can be published as a CSV at a public HTTPS URL (in Sheets: File → Share → Publish to web, then choose the sheet and Comma-separated values). You can also use the .../export?format=csv form of the sheet URL. Your site can fetch that file with no Google login at all.
Fetch it safely and cache it
- Fetch HTTPS only, with a size cap and a timeout. In WordPress,
wp_safe_remote_get()handles the safe-URL part. - Cache the parsed result in a transient. 15 minutes is a sensible default.
- Refresh on WP-Cron, and add a manual "sync now" button for when sales can't wait.
- Show the last sync time and the last error in the admin, so staff know when it breaks instead of finding out from a customer.
Match on a stable key
Give each unit a unique code (for example A-101) and update status, price, area, rooms and floor by matching on it. Never touch the drawn shape during a sync. That way sales can change data in the sheet without anyone moving polygons on the map.
Trade-offs
- A published sheet is public to anyone with the link, so keep only data you'd show on the website anyway.
- Sync is cached, not live. For a property site that's usually fine.
- If someone renames a unit code, that row stops matching. Test with a deliberately bad row and make sure the error is visible.
Where this came from
I built this into a WordPress plugin called UnitMap: draw clickable unit shapes over a site plan image, colour them by status, and collect enquiries. Disclosure: I'm the developer, the Google Sheet sync is in the Pro version, and Pro isn't on sale yet. I wrote this post with help from an AI assistant and checked it against the plugin.
- Free version demo (runs in your browser, sample data): https://playground.wordpress.net/?blueprint-url=https://davidcorney4.github.io/unitmap-demo/blueprint-en.json
- Pro preview: https://davidcorney4.github.io/unitmap-demo/static-pro-preview/
- Project page and Free zip: https://davidcorney4.github.io/unitmap-demo/
If you'd want Pro, email davidcorney4@gmail.com with the subject "UnitMap Pro waitlist – devto". I'm also happy to answer questions about the sync approach in the comments.
Top comments (0)