Member-only story
Referring Columns By Name in Google Sheets Query()
How to query a Google Sheet by referring columns by names? This is an issue we experience in particular when importing external CSV files (Comma-Separated Values). I will show a better way to import and link CSV files in a Google Spreadsheet. I will also explain a simple technique on how to query data from an external CSV using the powerful query() function to create more resilient and robust spreadsheets.
Google Sheets, an important component of the largest Google G Suite or Google Workspace, are becoming an essential tool for many people to automate repetitive tasks or to create MVPs (Minimum Viable Product). Many times, we find Google Sheets to be the quickest and most approachable tool to automate a new business process. In many cases, that involves importing one or more CSV files from an external systems (e.g. your eCommerce, Advertising, or CRM platforms) to generate reports and trigger certain actions. In a very dynamic and quickly evolving context, the structure of the CSV files we need to import can frequently change. Any change to a CSV structure or taxonomy can disrupt our Google Spreadsheets that are linking to it. But don’t worry, there is a simple technique to protect the consistency of a spreadsheet even when the CSV files structure changes significantly.