반응형
👋 안녕하세요!
지난 시간엔 구글 시트로 단어를 자동 정리하는 기본 팁들을 알려드렸죠?
이번엔 그 내용을 한 단계 업그레이드해서,
“클릭 한 번으로 단어 정리를 끝내는 사이드바 자동화” 기능을 소개해드릴게요!
매번 함수 쓰기 귀찮고 복잡했다면,
이제는 버튼 하나로 정리·정렬·분리까지 해결할 수 있어요 💡
그럼 바로 시작해볼까요?
🚴♀️ 먼저 핵심 요점부터 짚고 갈게요!
✔ 핵심 포인트 ① : 사이드바로 자동 정리 기능 구현
✔ 핵심 포인트 ② : 정렬·중복제거 버튼 클릭으로 즉시 실행
✔ 핵심 포인트 ③ : 사용자 친화형 UI로 누구나 쉽게 사용
🔍 왜 이 기능이 필요할까요?
데이터를 매번 함수 쓰며 정리하기 번거롭지 않으셨나요?
예를 들어,
“자주 쓰는 정렬, 중복 제거, 단어 분리를 버튼 하나로 해결하고 싶다!”
이런 고민이 있으셨다면 오늘 알려드리는 사이드바 자동화 기능이 딱이에요 💡
📌 실전 구현 방법 – Google Apps Script
✅ 1. 기본 사이드바 UI 코드
function showSidebar() {
const html = HtmlService.createHtmlOutputFromFile('Sidebar')
.setTitle('단어 정리 사이드바');
SpreadsheetApp.getUi().showSidebar(html);
}
✅ 2. HTML 파일 (Sidebar.html)
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<style>
button {
width: 100%; padding: 10px; margin: 5px 0; font-size: 14px;
}
</style>
</head>
<body>
<h3>단어 정리 도구</h3>
<button onclick="google.script.run.sortWords()">가나다순 정렬</button>
<button onclick="google.script.run.removeDuplicates()">중복 제거</button>
<button onclick="google.script.run.splitWords()">단어 분리</button>
</body>
</html>
✅ 3. 기능 처리 스크립트
function sortWords() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const data = sheet.getRange("A2:A").getValues().flat().filter(String);
data.sort();
sheet.getRange(2, 2, data.length).setValues(data.map(e => [e]));
}
function removeDuplicates() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const data = sheet.getRange("A2:A").getValues().flat().filter(String);
const unique = [...new Set(data)];
sheet.getRange(2, 3, unique.length).setValues(unique.map(e => [e]));
}
function splitWords() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const data = sheet.getRange("A2:A").getValues().flat().filter(String);
const split = data.map(e => e.split(" "));
sheet.getRange(2, 4, split.length, split[0].length).setValues(split);
}
💬 서초바이크 한마디 TIP
👉 “사이드바 UI 버튼 하나로 반복 작업을 확 줄일 수 있어요!”
📸 실사용 후기 예시
“정말 편해졌어요! 이제는 데이터 정리할 때 함수 검색할 필요가 없네요.”
✔ 단어 정렬 → 버튼 클릭 끝
✔ 중복 제거 → 실시간 반영
✔ 단어 분리 → 열마다 자동 정리됨
💡 실전 활용 꿀팁
- 여러 시트에서도 쓰고 싶다면 ActiveSheet → getSheetByName()로 확장
- 디자인 강화하고 싶다면 CSS로 버튼 스타일링 추가!
✅ 오늘의 요약 정리
- ✔ 구글 시트 사이드바 자동화로 업무 효율 UP
- ✔ 정렬/중복 제거/분리 기능도 버튼 클릭 한방
- ✔ 누구나 쉽게 구현 가능한 Apps Script 구성
728x90
반응형
그리드형
댓글