Skip to content

Instantly share code, notes, and snippets.

@tnwei
Created January 19, 2020 16:07
Show Gist options
  • Save tnwei/6005afe55cb8898ba87daa36fce23392 to your computer and use it in GitHub Desktop.
Save tnwei/6005afe55cb8898ba87daa36fce23392 to your computer and use it in GitHub Desktop.
Finding first code cell in a Jupyter notebook with Javascript
window.findFirstCodeCell = function findFirstCodeCell() {
var cells = Jupyter.notebook.get_cells();
for (var i = 0; i < cells.length; i++) {
if (cells[i]["cell_type"] == "code" ){
return i;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment