Bulk migrate identical scripts from Rhino to V8

  • Identical Apps Scripts using the Rhino runtime must be migrated to V8 before January 31, 2026.

  • The Apps Script API allows for migrating multiple identical scripts from Rhino to V8 simultaneously.

  • To migrate using the API, you need to set up your environment by enabling APIs, configuring a Cloud project, and creating an Apps Script project linked to it.

  • Migrating scripts involves replacing the existing files in each script project with V8-compatible files using theprojects.UpdateContent method, ensuring all original files are included to avoid deletion.

This page describes how to migrate identical scripts to V8 usingApps Script and the Apps Script API.

You must migrate any scripts that use the Rhino runtime before Rhino is turneddown, happening on or after January 31, 2026. If you have multiple, identicalscripts running on Rhino, you can migrate them to V8 all together usingthe Apps Script API.

Set up your environment

  1. From the Apps Script dashboard settings, turn on theApps Script API.
    1. Go to theApps Script dashboard settings.
    2. If the API is turned off, clickGoogle Apps Script API, then turn onthe Google Apps Script API toggle.
  2. Create a standard Google Cloud project or reuse an existing project.
  3. In your Cloud project,configure the OAuth consent screen.
  4. In your Cloud project,turn on the Apps Script API.

    Turn on the Apps Script API

  5. Create an Apps Script project and assign theApps Script project to your Cloud project.

    1. Create a standalone Apps Script project from theApps Script dashboard or by going toscript.new.
    2. ClickProject SettingsThe icon for project settings.
    3. In theGoogle Cloud Platform (GCP) Project section, clickChange project.
    4. Enter the project number of your Cloud project.
    5. ClickSet project.

Migrate scripts

The following code sample shows how to use the Apps Script API tomigrate identical scripts from Rhino to V8 by replacing the files in eachApps Script project with a set of V8-compatible files.

Important: When you use theprojects.UpdateContentmethod of the Apps Script API, you must include all the files in thescript project, even ones that you don't want to change. If you don't include afile, the file is deleted and can't be restored.

Make sure you have at least editor access to the script projects you plan tomigrate.

Code.gs

functionupdateRhinoScripts(){// An array of script IDs of script projects to migrate.// TODO(developer): Replace with your script IDs.constscriptIds=['abcdef12345678','abcdef12345678'];// An array of file objects to replace the existing files in each script project.// Remember to include all files for the script, excluded files are deleted.// TODO(developer): Replace with your script files.constfilesToUpdate={"files":[{"name":"Code","type":"SERVER_JS","source":"// New updates\nfunction myFunction() {\n  console.log('Hello, world!');\n}"},{"name":"appsscript","type":"JSON","source":JSON.stringify({"timeZone":"America/New_York","dependencies":{},"exceptionLogging":"STACKDRIVER","runtimeVersion":"V8"})}]};updateMultipleAppsScripts(scriptIds,filesToUpdate);}functionupdateMultipleAppsScripts(scriptIds,filesToUpdate){// 'scriptIds' should be an array of script IDs// 'filesToUpdate' should be an array of objects, each with:// name: The filename (For example, "Code", "Utilities")// source: The source code for that file.scriptIds.forEach(function(scriptId){// Makes the API request.constresponse=UrlFetchApp.fetch(`https://script.googleapis.com/v1/projects/${scriptId}/content`,{method:"PUT",headers:{Authorization:`Bearer${ScriptApp.getOAuthToken()}`},contentType:"application/json",payload:JSON.stringify(filesToUpdate),muteHttpExceptions:true});if(response.getResponseCode()!==200){console.log(`Error updating script${scriptId}:${response.getContentText()}`);}else{console.log(`Script${scriptId} updated successfully!`);}});}

appsscript.json

To use the Apps Script API in your Apps Scriptproject, you must add the following OAuth scopes to your manifest file:

  • "https://www.googleapis.com/auth/script.projects"
  • "https://www.googleapis.com/auth/script.external_request"

To expose the manifest file in the editor, clickProject SettingsThe icon for project settingsand check theShow "appsscript.json" manifest file in editor box. Thefollowing is a sample manifest file with the appropriate OAuth scopes:

{"timeZone":"America/Denver","dependencies":{},"oauthScopes":["https://www.googleapis.com/auth/script.projects","https://www.googleapis.com/auth/script.external_request"],"exceptionLogging":"STACKDRIVER","runtimeVersion":"V8"}

Related topics

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-11 UTC.