Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Jescanellas Script
- //https://stackoverflow.com/a/56664841/10789707
- //https://docs.google.com/spreadsheets/d/1v6jTVZQY-5aneKUhwpMqurnVZelUsnQFNQueFFH0yA4/edit?usp=sharing
- function numcharsbetweenocc1and2ofApple() {
- var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet4");
- var string = sheet.getRange(1, 2).getValues().toString();
- var apple_length = "apple".length;
- var first_apple = string.indexOf("apple") + apple_length;
- var second_apple = string.indexOf("apple", first_apple);
- var result = second_apple - first_apple;
- if (string !== "") {
- sheet.getRange(1, 3).setValue(result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement