[Data management]#3 GAS: 24시간 멈추지 않는 공장(GAS:The 24/7 Unmanned Factory)

The Physical Limit: Breaking free from the local desktop constraint—why your automation scripts shouldn't depend on your laptop being kept turned on.

Serverless Cloud Power: How Google Apps Script (GAS) processes your datasets 24/7 inside monolithic global data centers with exactly 0% local CPU usage.

Autonomous Time Triggers: Utilizing built-in time-driven scheduling to execute critical workflows automatically, even when your machine is completely dead silent.

Ready to decouple your workflows from hardware? Let's build a fully autonomous data pipeline in the cloud.


1. 파이썬 로컬 자동화가 마주한 '물리적 한계'

앞선 포스팅에서 우리는 파이썬과 Pandas를 활용해 수백 개의 엑셀 파일을 1초 만에 제어하는 강력한 로컬 데이터 파이프라인을 구축했습니다. 내 컴퓨터(VS Code)에서 터미널 로그를 보며 데이터가 융합되는 과정은 매우 짜릿한 경험입니다.

하지만 실무에 이 시스템을 본격적으로 적용하다 보면, 또 하나의 거대한 운영적 난관에 봉착하게 됩니다. 바로 "내가 퇴근해도, 내 컴퓨터를 꺼도 이 프로그램이 정해진 시간에 알아서 돌아갈 수 있는가?"의 문제입니다.

파이썬 로컬 코드는 Windows의 작업 스케줄러나 Mac의 크론탭(Crontab)을 통해 특정 시간 예약을 걸어둘 수 있습니다. 그러나 치명적인 전제조건이 있습니다. 그 시간에 내 컴퓨터가 항상 켜져 있고, 절전 모드가 해제되어 있으며, 인터넷에 연결되어 있어야 한다는 점입니다. 새벽 2시에 학원 원생들의 출결 마감 리포트를 발송해야 하는데, 내 노트북이 덮여 있다면 자동화 공정은 그대로 올스톱(All-Stop)됩니다.

내 컴퓨터를 24시간 켜두는 워크스테이션으로 만들지 않는 이상, 로컬 인프라는 결국 물리적 전원 스위치라는 한계에 갇히게 됩니다.


2. 클라우드에 짓는 무인 공장: Google Apps Script (GAS)

이 물리적 한계를 깨부수는 기술적 돌파구가 바로 Google Apps Script(GAS)입니다.

GAS는 내 컴퓨터의 CPU나 메모리를 단 1%도 쓰지 않습니다. 모든 코드가 구글이 전 세계에 구축해 둔 초거대 클라우드 데이터 센터(구글 서버) 위에서 직접 구동되는 서버리스(Serverless) 아키텍처이기 때문입니다.

내가 노트북을 끄고 비행기를 타고 있든, 침대에서 깊은 잠에 빠져 있든 상관없습니다. 구글의 클라우드 엔진이 우리가 설계한 자동화 코드를 대신 보관하고 있다가 24시간 내내 대기하며 정해진 로직을 실행합니다. 내 로컬 컴퓨터의 상태와 완전히 디커플링(Decoupling)된 진정한 무인 자동화 공장이 완성되는 순간입니다.


3. GAS의 핵심 엔진: 시간 설정 트리거(Time-driven Trigger)

GAS가 24시간 무인으로 돌아갈 수 있는 비밀은 바로 구글 클라우드가 내장하고 있는 '트리거(Trigger)' 시스템에 있습니다. 복잡한 서버 명령어를 배울 필요도 없이, 구글이 제공하는 직관적인 UI 화면에서 몇 번의 클릭만으로 완벽한 시간 예약 공정을 매핑할 수 있습니다.

  • 특정 시간 실행: "매일 새벽 2시마다 각 분원의 구글 시트 데이터를 취합해라."
  • 주기적 실행: "1시간마다, 혹은 15분마다 강사들의 입력 현황을 체크해서 슬랙(Slack) 알림을 쏴라."
  • 📩 이벤트 기반 실행: "학부모가 구글 설문지(Forms)를 제출하는 '이벤트'가 발생한 즉시 상담 배정 메일을 발송해라."

로컬 파이썬이 '내가 에디터를 켜고 실행 버튼을 누르는 순간' 작동하는 수동형 엔진이라면, GAS는 '구글 서버가 스스로 시간을 감시하다가 조건이 충족되면 코드를 깨우는' 완전 자율형 엔진입니다. 다음 포스팅에서는 이 강력한 GAS 시간 트리거를 활용해, 내 컴퓨터가 꺼져 있어도 구글 시트 내의 특정 열 값들을 조합하여 정밀하게 데이터를 자동 가공 처리하거나, 구글 캘린더의 일정 취소 및 변동 사항을 실시간으로 감지하여 담당자에게 즉각 알림을 보내는 등 실무에 바로 적용할 수 있는 강력한 엔터프라이즈급 실전 아키텍처 코드를 뜯어보겠습니다.




1. The Physical Wall of Local Python Automation

In our previous posts, we harnessed the power of Python and Pandas to construct a robust local data pipeline capable of consolidating hundreds of Excel files in under a second. Watching datasets seamlessly merge in real time right inside your VS Code terminal is undeniably satisfying.

However, as you deploy these systems into real-world production, you inevitably run into a massive operational bottleneck: "Can this program run on its own at a designated time, even after I log off or shut down my computer?"

With local Python scripts, you can admittedly schedule tasks using Windows Task Scheduler or macOS Crontab. But there is a critical, uncompromising catch: your computer must remain powered on, awake, and connected to the internet at that exact moment. If you need to dispatch a finalized student attendance report at 2:00 AM, but your laptop lid is closed, your entire automated pipeline grinds to an absolute halt.

Unless you are willing to convert your local machine into a 24/7 running workstation, your local infrastructure will always remain trapped behind a physical power switch.


2. Building an Unmanned Factory in the Cloud: Google Apps Script (GAS)

This is exactly where Google Apps Script (GAS) comes in as a game-changing technical breakthrough.

GAS consumes exactly 0% of your local CPU and memory. It operates on a Serverless Architecture, meaning all your code lives, breathes, and executes entirely inside Google’s monolithic global data centers.

It does not matter if your laptop is shut down, if you are mid-flight, or if you are fast asleep. Google’s cloud engine hosts your automation code, standing by 24/7 to execute your logic precisely when triggered. This is the exact moment your automation becomes completely decoupled from your local hardware, evolving into a true unmanned factory.


3. The Core Engine of GAS: Time-Driven Triggers

The secret behind GAS’s ability to run independently around the clock lies in its native Trigger System. You don't need to struggle with complex Linux server commands or cron syntax. Google provides an intuitive, streamlined GUI that lets you map out flawless scheduling workflows in just a few clicks:

  • Specific Time Execution: "Every day at 2:00 AM, automatically aggregate Google Sheet data across all regional branches."
  • Interval-Based Execution: "Every hour—or even every 15 minutes—check instructor data entries and blast a real-time update to Slack."
  • 📩 Event-Driven Execution: "The exact instant a parent submits a Google Form, trigger an event to automatically dispatch a consultation routing email."

While local Python functions as a passive engine—waiting for you to open the editor and hit the execution button—GAS is a fully autonomous engine. The cloud server continuously monitors the time and wakes up the code the moment your conditions are met. In our next section, we will break down the production-ready code to leverage these time-driven triggers: dynamically combining and processing multi-column values in Google Sheets for automated data engineering, and real-time tracking of Google Calendar schedule updates or cancellations to immediately dispatch alert notifications—proving that true automation never sleeps, even when your computer is dead silent.

Comments

Popular posts from this blog

[Data management]#1 엑셀: 익숙한 시작 (Excel: The Familiar Starting Point)

[Data management]#2 파이썬: 데이터 핸들링의 자유와 시스템 확장 (Python: Mastering Data Handling and System Scalability)

[Insight]#1 시스템 모멘텀과 리스크 제어: 흐름(Mastering System Momentum: Risk Control in the Face of the Run)