A dynamic and automated Air Quality Monitoring Dashboard built entirely in Google Sheets, powered by real-time data from the Government of India’s open data platform (data.gov.in). The dashboard allows interactive selection of Indian cities, shows pollution levels at multiple stations, and visualizes AQI metrics across pollutants in real-time.
Includes max AQI, dominant pollutant, bar chart of station-wise AQI, pie chart for pollutant breakdown.
- 🔄 Automatic Data Fetching via API (data.gov.in)
- 🏙️ City-Level Selection using dropdown menu
- 🧪 Station-wise pollutant readings (PM2.5, PM10, NO2, SO2, CO, OZONE, NH3)
- 📈 Dynamic Dashboard with Pivot Tables and Charts
- 🎯 AQI calculated from raw pollutant data using CPCB breakpoints
- 📊 Charts include:
- Dominant pollutant pie chart
- Bar chart of station-wise AQI
- Max AQI across city stations
- ⏱️ Hourly auto-refresh of data
- ☁️ No external software required — runs entirely in Google Sheets & Apps Script
-
Google Apps Script fetches hourly AQI data from:
-
On opening the sheet:
- A custom menu
AQI Tools
appears. - You select a city from a dropdown cell (
I1
in dashboard sheet). - Click "Fetch Data for Selected City" from the menu.
- All valid pollutant data for that city is fetched and added to a hidden sheet.
- A custom menu
-
AQI is calculated per station using CPCB breakpoints (for PM2.5, PM10, etc.).
-
Pivot tables and charts auto-update based on current data. (you may need to change the range in pivot tables as number of stations in each city are different)
AQI is computed using CPCB AQI breakpoints for each pollutant. The script uses the following formula:
AQI = ((Ihigh - Ilow)/(BPhigh - BPlow)) * (Cp - BPlow) + Ilow
Where:
Cp
: pollutant concentrationBPlow
,BPhigh
: breakpoint range for that pollutantIlow
,Ihigh
: corresponding AQI range
Only pollutants with valid min
, max
, and avg
values are considered.
dynamic-aqi-dashboard/ │ ├── README.md ├── src/ │ ├── main.js # Main data fetch + menu setup │ ├── claculateAQI.js # AQI calculation logic using CPCB breakpoints │ ├── sample_data/ │ └── city_raw.csv # Example dataset for testing │ ├── assets/ │ ├── AQI OF CITY.png │ └── Dominant Pollutant.png │ └── AQI AT DIFFERENT STATIONS.png
- A Google account
- Access to Google Sheets
- Free API key from data.gov.in
-
Make a copy of the Sheet or create a new one.
-
Go to
Extensions → Apps Script
. -
Paste the code from
/src/
into.gs
files. -
Save and deploy the script.
-
Set the script property:
PropertiesService.getScriptProperties().setProperty( "API_KEY", "YOUR_API_KEY_HERE" );
-
Use Triggers to automate hourly refresh: fetchCityAQIData → every hour clearDailyDataIfNeeded → daily at 00:00
-
Use the custom menu "AQI Tools" to fetch data manually or calculate AQI on demand.
-
Customize the dashboard visuals and pivot tables as needed.
This project is licensed under the MIT License — you’re free to use, share, and modify it with attribution.
Built by [Gourav Verma] ✨
Data Source: data.gov.in – Real-Time AQI API
Powered by: Google Sheets, Google Apps Script, and CPCB AQI Standards
air-quality
· aqi-dashboard
· google-sheets
· apps-script
· environment
· india
· pollution-data
· data-visualization
·