Last active
September 10, 2022 11:25
-
-
Save srsandy/d5edbf187b0c02e7adf55b7dd1163c88 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function myFunction() { | |
// var activeSpreadsheet = SpreadsheetApp.getActiveSpreadsheet(); | |
// var activeSheet = activeSpreadsheet.getActiveSheet(); | |
var ss = SpreadsheetApp.getActive(); | |
var allsheets = ss.getSheets(); | |
for(var s in allsheets){ | |
var targetSheet = allsheets[s]; | |
SpreadsheetApp.setActiveSheet(targetSheet); | |
var lrow = targetSheet.getLastRow(); | |
var lcol = targetSheet.getLastColumn(); | |
for (var i = 1; i <= lrow; i++) { | |
for (var j = 1; j <= lcol; j++) { | |
var val = targetSheet.getRange(i, j).getValue(); | |
if ( val != "" && isNaN(val) ) { | |
var activeCellText = val; | |
var activeCellTranslation = LanguageApp.translate(activeCellText, 'ja', 'en'); | |
targetSheet.getRange(i, j).setValue(activeCellTranslation); | |
} | |
} | |
} | |
} | |
/* var targetSheet = activeSheet; | |
var lrow = targetSheet.getLastRow(); | |
var lcol = targetSheet.getLastColumn(); | |
for (var i = 1; i <= lrow; i++) { | |
for (var j = 1; j <= lcol; j++) { | |
var val = targetSheet.getRange(i, j).getValue(); | |
if ( val != "" && isNaN(val) ) { | |
var activeCellText = val; | |
var activeCellTranslation = LanguageApp.translate(activeCellText, 'ja', 'en'); | |
targetSheet.getRange(i, j).setValue(activeCellTranslation); | |
} | |
} | |
} */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment