GPT4 응용하기(구글 form)
구글 form은 사람에게서 정보를 얻을 때, 유용한 도구이다.
다음과 같은 상황을 가정해보자.
100명의 사람들에게 설문을 요청한다.
설문내용은 위 표에 나온 29명의 사람들 중에 선호하는 사람을 고르는 것이다.
구글 form을 만들어야하는데..
Dropdown을 만드려고 하니까 29명을 다 손으로 적어야할 판이다.
GPT4에게 도움을 요청해보자.
질문을 한글로 해도 괜찮은데, 나는 영어로 물어볼 것이다.
질문: "I want to make the data from A2 to A30 in Google sheet into a dropdown in Google form. Please implement it as a Google Apps script."
답변: To achieve this, you will need to write a Google Apps Script that reads the data from a Google Sheet and then updates a Google Form to include this data as options in a dropdown question. Here is a step-by-step guide to implementing this:
-
Open your Google Sheet where you have the data from A2 to A30.
-
Open the Script Editor by going to Extensions > Apps Script.
-
Replace any code in the Script Editor with the following script. This script reads the values from A2 to A30 in the active sheet and then updates a dropdown item in a specified Google Form. Ensure you replace 'FORM_ID' with your actual Google Form ID, which can be found in the form's URL.
-
Save the script with a name, for example, Update Form Dropdown.
-
Run the script by clicking the play/run button in the toolbar. The first time you run the script, you will need to authorize it. Follow the prompts to grant the necessary permissions.
-
Check your Google Form to see if the dropdown has been updated with the values from your sheet.
Note: This script assumes there's at least one dropdown (multiple choice) item in your form. If your form doesn't have one, add a multiple-choice question to your form manually, and then run the script again. Additionally, if your form has multiple dropdown questions, you'll need to adjust the script to select the correct one, as this script only updates the first multiple-choice item it finds.
코드 2번째 줄의 주석을 보면 var formId = 'FORM_ID'; // Replace FORM_ID with your Google Form ID라고 적혀있는데, 이 ID라는 녀석에 대해 알아보자.
구글ID란 구글문서를 식별하는 고유값으로 URL의 중간에 들어있다. 예를 들어 AI유명인이 적힌 구글 시트의 주소가 아래와 같다면
https://docs.google.com/spreadsheets/d/1hh5JwvmPyFFmq6aYtydGFYXj4AdfLNRngJdJBYAITTY/edit#gid=0
ID는 1hh5JwvmPyFFmq6aYtydGFYXj4AdfLNRngJdJBYAITTY가 된다.
구글 form의 주소가 아래와 같다면
https://docs.google.com/forms/d/1AVlgr7FR_azFAVQmHkXl7bspudFTqhJdxf_6hNI9C1I/edit
ID는 1AVlgr7FR_azFAVQmHkXl7bspudFTqhJdxf_6hNI9C1I가 된다.
이제 구글 앱스 스크립트를 넣어보자 만들어보자. 아래 사진을 따라하자.
코드를 복사 붙여넣자. 코드의 주석을 잘 보면서 구글 폼의 ID를 바꿔넣자(3번째줄)
Run(실행)버튼을 누르면
이렇게 바뀐다. 주의할 점은 설문의 첫번째 항목이 dropdown이 아니라 multiple choice여야 한다는 것이다.
GPT4 답변의 note에 그렇게 적혀있었다.
위 과정은 3분도 걸리지 않았다. 만약 항목의 갯수가 100개가 넘어가면 압도적인 효율을 자랑할 것이다.
그리고 설문조사가 잦은 업무를 한다면 강력한 도구가 될 것이다.
댓글 0