I would like to run only selected lines instead of the full script in Google Earth Engine. Is there any way to do so?

  • No this isn't a possibility. You can only comment out lines you don't want to run
    – JonasV
    Jan 4, 2021 at 15:58

3 Answers 3


Indeed, that feature is not supported by GEE, as the others said. What you can do is comment out the lines you don't want to run by selecting them and use the keyboard shortcut Ctrl+/


You only have to put /* at the beginning of the block of code you want to comment and */ at the end, so all the lines of code inside will not be executed.

But if you want to make it easy to locate these comment marks when you'll want to remove them, you can put them like that /************* at the beginning of the block of code and *************/ at the end with any number of stars.


This feature is not supported in the Earth Engine code editor currently.

  • So, GEE newbie question: it seems that nothing at all is persistent in GEE memory. For example, if I create an image usingvar img1 = ImageCollection.filter... etc., then comment out the creation lines and try running a line that refers to img1 (for example, img1.getinfo()), it throws an error "img1 is not defined." I don't see much utility in commenting out lines in that case. Am I missing something?
    – John
    Mar 26, 2023 at 23:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.