이 대결의 목표는 구글 스크립트(GAS)를 이용해서, 위 사진에 나와있는 구글 시트의 A2셀에서 '과학'이라고 적힌 글자를 붉게 만드는 것이다.
성공하면 아래 사진처럼 나와야한다.
GPT4는 공식 홈페이지 챗봇을 활용하였고, 바드프로도 바드홈페이지 챗봇을 활용하였다. 공정한 경기를 위해, 영어로 질문할 것이다.
- GAS가 무엇인가요?(What is GAS on Google?)
| GPT4 | 바드프로 |
|---|---|
GAS in the context of Google refers to "Google Apps Script." Google Apps Script is a cloud-based scripting language for light-weight application development in the Google Workspace platform. It allows users to automate workflows across Google products and third-party services. With Google Apps Script, you can create custom functions, automate tasks within Google Sheets, Docs, Forms, Slides, and Gmail, develop add-ons for Google Sheets, Docs, and Forms, and access Google APIs to manage other Google services. Scripts can be written directly in the Google Apps Script editor, a web-based IDE, and can interact with other Google services or external APIs to perform various tasks automatically. For example, you might use Google Apps Script to: Generate automated emails based on specific triggers. Manipulate data in Google Sheets with custom functions or scripts. Create custom menus and interfaces within Google Docs, Sheets, or Forms. Connect Google Workspace apps with external databases or APIs. Automate document approval workflows. Google Apps Script is built on JavaScript, making it accessible to a wide range of users, from professional developers to those with less coding experience who are looking to automate repetitive tasks and enhance their productivity within Google Workspace. |
Google Apps Script (GAS): This is a free, cloud-based platform that allows you to create custom scripts to automate tasks and extend the functionality of various Google services, such as Gmail, Calendar, Drive, and Sheets. It uses JavaScript as the programming language, making it familiar for web developers. (이 자리에는 사진이 있었음.) Gasoline: Google also provides information on gasoline prices and gas stations through various services like Google Maps and GasBuddy. You can use these services to find the cheapest gas stations near you. Image of Gas station iconOpens in a new window (이 자리에는 사진이 있었음.) Which meaning of "GAS" were you interested in learning more about? |
| GPT4 한글------------------> |
GAS는 "Google Apps Script"의 약어입니다. Google Apps Script는 구글의 G Suite 서비스(구글 드라이브, 스프레드시트, 문서, 캘린더 등)와 상호작용하는 데 사용되는 클라우드 기반 스크립팅 언어입니다. 이를 통해 사용자는 간단한 코드를 작성하여 구글 서비스의 기능을 자동화하거나 확장할 수 있습니다. 예를 들어, 구글 스프레드시트에 데이터를 자동으로 입력하거나, 이메일 알림을 자동으로 보내는 등의 작업을 할 수 있습니다. |
- 구글 스프레드시트의 GAS를 이용해서, A2에 있는 '과학'이라는 단어는 모두 붉게 만들어주세요.(Using GAS in Google Sheets, I want to make any word "과학" red in cell A2. Give me the code.)
| GPT4 | 바드프로 |
|---|---|
| //GPT4 function makeWordRed_GPT4() { var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); var cell = sheet.getRange('A2'); var text = cell.getValue(); var richText = SpreadsheetApp.newRichTextValue() .setText(text); // Search for the word "과학" and apply red color var startIndex = 0; var searchWord = "과학"; while (text.indexOf(searchWord, startIndex) !== -1) { var foundAt = text.indexOf(searchWord, startIndex); var endIndex = foundAt + searchWord.length; richText.setTextStyle(foundAt, endIndex, SpreadsheetApp.newTextStyle() .setForegroundColor("#FF0000") .build()); startIndex = endIndex; // Update startIndex to search for next occurrence } // Set the updated rich text value to the cell cell.setRichTextValue(richText.build()); } |
//BARD function makeWordRed() { var sheet = SpreadsheetApp.getActiveSheet(); var cell = sheet.getRange("A2"); var cellValue = cell.getValue(); // Split the cell value into words var words = cellValue.split(/\s+/); // Create a new string with the target word in red var newCellValue = ""; for (var i = 0; i < words.length; i++) { if (words[i] == "과학") { newCellValue += "<2font color='red'>" + words[i] + "</2font> "; } else { newCellValue += words[i] + " "; } } // Set the new value with rich text formatting cell.setRichTextValue(newCellValue); } |
| GPT4는 두번째 만에 성공 | 바드프로는 25번의 질문을 했지만 위와 비슷한 코드를 매번 뱉어내면서, 단 한번도 성공하지 못했다. |
참고
https://chat.lmsys.org/
위 사이트는 api를 쓸 수 있게 해주는 사이트인데, 위 과제에서 성공한 것은 gpt-4-turbo뿐이었다. 놀랍게도 첫트만에 성공.
| GPT4-turbo |
|---|
| function makeWordRedInA2() { var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); var cell = sheet.getRange("A2"); var text = cell.getValue(); if (text.indexOf("과학") !== -1) { // Create a rich text value builder var richText = SpreadsheetApp.newRichTextValue() .setText(text); // Find all occurrences of the word and set the color to red var startIndex = 0, index; while ((index = text.indexOf("과학", startIndex)) > -1) { richText.setTextStyle(index, index + "과학".length, SpreadsheetApp.newTextStyle() .setForegroundColor("red") .build()); startIndex = index + "과학".length; // Update the index to the end of the current occurrence to find next } // Set the rich text value to the cell cell.setRichTextValue(richText.build()); } } |
이런 실험 좋다 난 언어적인 부분에서 계속 테스트 하고 있었는데 코딩능력도 테스트 해보고 싶네