Loading...
    • Developer Guide
    • API Reference
    • MCP
    • Resources
    • Release Notes
    Search...
    ⌘K

    Resources

    overviewGlossarySystem Prompts

    Use cases

    OverviewTicket routingCustomer support agentContent moderationLegal summarization

    Prompt Library

    Prompt LibraryCosmic KeystrokesCorporate clairvoyantWebsite wizardExcel formula expertGoogle apps scripterPython bug busterTime travel consultantStorytelling sidekickCite your sourcesSQL sorcererDream interpreterPun-ditCulinary creatorPortmanteau poetHal the humorous helperLaTeX legendMood colorizerGit gudSimile savantEthical dilemma navigatorMeeting scribeIdiom illuminatorCode consultantFunction fabricatorNeologism creatorCSV converterEmoji encoderProse polisherPerspectives pondererTrivia generatorMindfulness mentorSecond-grade simplifierVR fitness innovatorPII purifierMemo maestroCareer coachGrading guruTongue twisterInterview question crafterGrammar genieRiddle me thisCode clarifierAlien anthropologistData organizerBrand builderEfficiency estimatorReview classifierDirection decoderMotivational museEmail extractorMaster moderatorLesson plannerSocratic sageAlliteration alchemistFuturistic fashion advisorPolyglot superpowersProduct naming proPhilosophical musingsSpreadsheet sorcererSci-fi scenario simulatorAdaptive editorBabel's broadcastsTweet tone detectorAirport code analyst
    Console
    Prompt Library

    Google apps scripter

    Generate Google Apps scripts to complete tasks based on user requirements.

    Copy this prompt into our developer Console to try it for yourself!

    Content
    UserWrite me a Google apps script that will translate all text in a Google Slides presentation to Korean.

    Example Output

    Here's a Google Apps Script that translates all the text in a Google Slides presentation to Korean:

    function translateSlidesToKorean() {
      var presentation = SlidesApp.getActivePresentation();
      var slides = presentation.getSlides();
    
      for (var i = 0; i < slides.length; i++) {
        var slide = slides[i];
        var pageElements = slide.getPageElements();
    
        for (var j = 0; j < pageElements.length; j++) {
          var pageElement = pageElements[j];
    
          if (pageElement.getPageElementType() === SlidesApp.PageElementType.SHAPE) {
            var shape = pageElement.asShape();
            if (shape.getText() !== null) {
              var text = shape.getText().asString();
              var translatedText = LanguageApp.translate(text, '', 'ko');
              shape.getText().setText(translatedText);
            }
          } else if (pageElement.getPageElementType() === SlidesApp.PageElementType.TABLE) {
            var table = pageElement.asTable();
            var numRows = table.getNumRows();
            var numColumns = table.getNumColumns();
    
            for (var row = 0; row < numRows; row++) {
              for (var col = 0; col < numColumns; col++) {
                var tableCell = table.getCell(row, col);
                var text = tableCell.getText().asString();
                var translatedText = LanguageApp.translate(text, '', 'ko');
                tableCell.getText().setText(translatedText);
              }
            }
          }
        }
      }
    }

    Here's how the script works:

    1. The translateSlidesToKorean() function retrieves the active Google Slides presentation using SlidesApp.getActivePresentation().

    2. It gets all the slides in the presentation using the getSlides() method.

    3. We iterate over each slide in the presentation.

    4. For each slide, we retrieve all the page elements (shapes, text boxes, tables, etc.) using the getPageElements() method.

    5. We iterate over each page element on the slide.

    6. We check the type of the page element using getPageElementType():

      • If the page element is a shape (SlidesApp.PageElementType.SHAPE), we get the text content of the shape using getText().asString(). We then translate the text to Korean using LanguageApp.translate(text, '', 'ko'), where '' represents the source language (auto-detect) and 'ko' represents the target language (Korean). Finally, we set the translated text back to the shape using setText().
      • If the page element is a table (SlidesApp.PageElementType.TABLE), we iterate over each cell in the table and translate the text within each cell similarly to how we handle shapes.
    7. The script continues to process all the page elements on each slide until all the text in the presentation has been translated to Korean.

    Note: This script assumes that you have the necessary permissions to access and modify the Google Slides presentation. Make sure you have the required access rights before running the script.

    Also, keep in mind that the translation is performed using the Google Translate API, so the quality of the translation may vary depending on the complexity of the text and the capabilities of the translation service.


    API Request

    • Example Output
    • API Request
    © 2025 ANTHROPIC PBC

    Products

    • Claude
    • Claude Code
    • Max plan
    • Team plan
    • Enterprise plan
    • Download app
    • Pricing
    • Log in

    Features

    • Claude and Slack
    • Claude in Excel

    Models

    • Opus
    • Sonnet
    • Haiku

    Solutions

    • AI agents
    • Code modernization
    • Coding
    • Customer support
    • Education
    • Financial services
    • Government
    • Life sciences

    Claude Developer Platform

    • Overview
    • Developer docs
    • Pricing
    • Amazon Bedrock
    • Google Cloud’s Vertex AI
    • Console login

    Learn

    • Blog
    • Catalog
    • Courses
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Company

    • Anthropic
    • Careers
    • Economic Futures
    • Research
    • News
    • Responsible Scaling Policy
    • Security and compliance
    • Transparency

    Help and security

    • Availability
    • Status
    • Support center

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy

    Products

    • Claude
    • Claude Code
    • Max plan
    • Team plan
    • Enterprise plan
    • Download app
    • Pricing
    • Log in

    Features

    • Claude and Slack
    • Claude in Excel

    Models

    • Opus
    • Sonnet
    • Haiku

    Solutions

    • AI agents
    • Code modernization
    • Coding
    • Customer support
    • Education
    • Financial services
    • Government
    • Life sciences

    Claude Developer Platform

    • Overview
    • Developer docs
    • Pricing
    • Amazon Bedrock
    • Google Cloud’s Vertex AI
    • Console login

    Learn

    • Blog
    • Catalog
    • Courses
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Company

    • Anthropic
    • Careers
    • Economic Futures
    • Research
    • News
    • Responsible Scaling Policy
    • Security and compliance
    • Transparency

    Help and security

    • Availability
    • Status
    • Support center

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy
    © 2025 ANTHROPIC PBC