VBA 매크로를 Apps Script로 변환
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
시작하기 전에
파일을 변환하기 전에 VBA 코드에서 호환되지 않는 API를 업데이트하는 것이 좋습니다. 상태가 정확히 지원됨인 파일의 경우 1단계: 파일 변환으로 진행하면 됩니다.
호환되지 않는 VBA API 수정
상태가 해결 방법이 지원됨 또는 조사가 필요함인 파일의 경우 Apps Script에서 변환한 후 해결 방법과 수정사항을 적용할 수 있지만, 파일을 변환하기 전에 먼저 익숙한 VBA 코드를 수정하는 것이 좋습니다.
호환성 보고서에서 해결 방법이 지원됨 또는 조사 필요로 표시된 각 API에 대해 다음을 권장합니다.
1단계: 파일 변환하기
- 컴퓨터에서 Google Drive를 엽니다.
- 오른쪽 패널에서 매크로 변환기 부가기능
을 클릭합니다. 측면 패널이 표시되지 않으면 오른쪽 하단에서 측면 패널 표시 chevron_left를 클릭합니다.
- 파일 및 폴더 추가를 클릭합니다. 매크로 변환기는 Excel 파일만 인식합니다.
- 변환할 파일 또는 폴더를 선택하고 선택을 클릭합니다. 한 번에 2,000개 미만의 파일을 선택합니다.
- 변환된 파일이 저장되는 위치를 변경하려면 대상 폴더 변경 edit을 클릭하고 원하는 폴더를 선택합니다. 그렇지 않으면 파일이 내 드라이브 폴더에 저장됩니다.
- 변환을 클릭합니다.
- 변환이 완료되면 결과 보기를 클릭합니다.
2단계: 변환된 파일 테스트하기
Apps Script 코드 실행
파일을 변환한 후 Apps Script 함수를 테스트합니다. 변환된 파일을 Excel 파일과 함께 일반적으로 사용하는 데이터로 테스트합니다. 가능하다면 변환된 Google Sheets 파일의 출력과 원본 Excel 파일의 출력을 비교합니다.
트리거 테스트
파일에 onOpen()
, onEdit()
, onClick()
와 같은 트리거가 포함되어 있으면 트리거도 테스트하세요. 일부 VBA 트리거는 자동으로 변환되지 않으므로 Apps Script에서 처리해야 합니다. 일반적인 문제 해결을 참고하세요.
ReadMe 파일 검토
변환된 파일과 함께 리드미 파일이 생성된 경우 리드미 파일에 나열된 변환 문제를 검토합니다.
- 문제가 테스트하지 않은 케이스에 문제가 될 수 있는 경우 권장되는 변경사항을 코드에 적용하세요.
- 가능한 모든 시나리오를 테스트했고 모든 것이 의도한 대로 작동한다면 변경할 필요가 없습니다.
3단계: 오류 수정
파일을 테스트하는 동안 오류가 발생하면 변환된 코드의 오류 수정을 참고하세요.
코드가 오류 없이 실행되지만 결과가 예상과 다른 경우 파일의 ReadMe 파일을 엽니다. 각 섹션을 검토하여 문제의 원인을 파악하고 권장되는 해결 방법을 적용하세요.
오류를 수정한 후 파일을 다시 테스트하여 모든 항목이 의도한 대로 작동하는지 확인합니다.
관련 도움말
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-31(UTC)
[null,null,["최종 업데이트: 2025-08-31(UTC)"],[[["\u003cp\u003eThe Macro Converter add-on helps you convert your VBA macros to Apps Script, allowing them to run in Google Sheets.\u003c/p\u003e\n"],["\u003cp\u003eBefore converting, review the compatibility report and modify or remove incompatible VBA APIs for better conversion results.\u003c/p\u003e\n"],["\u003cp\u003eThe conversion process involves adding files to the add-on, initiating the conversion, and then testing the converted Apps Script functions and triggers in Google Sheets.\u003c/p\u003e\n"],["\u003cp\u003eIf errors occur or the results are unexpected, consult the generated ReadMe files and the troubleshooting documentation to fix issues and ensure proper functionality.\u003c/p\u003e\n"],["\u003cp\u003eAfter successful conversion and testing, your macros will be operational within Google Sheets, leveraging the capabilities of Apps Script.\u003c/p\u003e\n"]]],[],null,["# Convert VBA macros to Apps Script\n\nBefore you begin\n----------------\n\nYou might want to update incompatible APIs in your VBA code before you convert\nyour files. For files that have the status *Supported exactly* , you can proceed\nto [Step 1: Convert your files](/apps-script/guides/macro-converter/convert-files#step_1_convert_your_files).\n\n### Modify incompatible VBA APIs\n\nFor files that have the status *Supported with workaround* or *Needs\ninvestigation*, you can apply your workarounds and fixes after the conversion\nin Apps Script, but we recommend that you modify the VBA code that you're\nfamiliar with first, before you convert your files.\n\nFor each API marked as *Supported with workaround* or *Needs investigation* in\nthe compatibility report, we recommend the following:\n\n- If the function performed by the API isn't critical to your VBA macro working properly, remove it from your VBA code. If it is, change your code to implement a similar behavior with [supported VBA APIs](/apps-script/guides/macro-converter/compatible-vba-apis).\n- For APIs with the status *Supported with workaround*, if you can't switch to supported VBA APIs, leave your VBA APIs as is. After you convert to Apps Script, a known workaround for this API is recommended in the comments of the converted Apps Script code.\n- If the issue is coming from an [unimplemented language construct](/apps-script/guides/macro-converter/fix-conversion-errors#unimplemented_language_constructs), rewrite your code to avoid using those constructs.\n- For APIs with the status *Needs investigation*, check if your code contains\n any of the following APIs:\n\n - `Adodb.connection`\n - `CreateObject`: This API is often used to connect to database and enterprise resource planning software.\n - `Shell.execute`\n - `OleObject`\n\n If yes, we recommend that you don't convert the files these APIs belong to\n and investigate other options. These APIs tend to perform critical operations\n for a macro, like connecting to a database or accessing a local resource, and\n Apps Script is generally not a good solution.\n\nStep 1: Convert your files\n--------------------------\n\n1. On your computer, open [Google Drive](https://drive.google.com/drive/my-drive).\n2. On the right side panel, click the Macro Converter add-on . If you don't see the side panel, at the bottom right, click Show side panel chevron_left.\n3. Click **Add files and folders**. The Macro Converter only recognizes Excel files.\n4. Choose the files or folders you want to convert and click **Select**. Select fewer than 2,000 files at a time.\n5. To change where your converted files are saved, click Change destination folder edit, and select the folder you want. Otherwise, the files are saved in your MyDrive folder.\n6. Click **Convert**.\n7. When the conversion completes, click **View results**.\n\nStep 2: Test your converted files\n---------------------------------\n\n### Run your Apps Script code\n\nAfter you convert your files, test the Apps Script functions. Test the converted\nfiles with the data you normally use with your Excel files. If possible, compare\nthe output of your converted Sheets files with the output of your original Excel\nfiles.\n\n### Test your triggers\n\nIf your files contain triggers like `onOpen()`, `onEdit()`, or `onClick()`, test\nyour triggers, too. Some VBA triggers won't convert automatically and need to be\naddressed in Apps Script. See [Address common issues](/apps-script/guides/macro-converter/address-conversion-issues).\n\n### Review ReadMe files\n\nIf a ReadMe file was generated with your converted file, review the conversion\nissues listed within the ReadMe file.\n\n- If the issues might be problematic for cases you haven't tested, apply the recommended changes to your code.\n- If you've tested all possible scenarios and everything works as intended, you probably don't need to make changes.\n\nStep 3: Fix errors\n------------------\n\nIf you run into errors while testing your files, see [Fix errors in your\nconverted code](/apps-script/guides/macro-converter/fix-conversion-errors).\n\nIf the code runs without errors, but the result isn't what you expected, open\nthe file's ReadMe file. Review each section to help determine what's causing the\nissue and apply the recommended fix.\n\nAfter you fix errors, test the file again to make sure everything works as\nintended.\n\nRelated articles\n----------------\n\n- [Macro Converter add-on overview](/apps-script/guides/macro-converter/overview)\n- [Determine if VBA macros are compatible](/apps-script/guides/macro-converter/compatibility-report)\n- [Fix errors in your converted code](/apps-script/guides/macro-converter/fix-conversion-errors)\n- [Address common issues](/apps-script/guides/macro-converter/address-conversion-issues)\n- [Watch Macro Converter tutorials](/apps-script/guides/macro-converter/tutorials)\n- [List of compatible VBA APIs](/apps-script/guides/macro-converter/compatible-vba-apis)"]]