11

How can I copy multiple cells from one jupyter notebook to another notebook at once, and the cells will not merge after pasting?

I have tried this solution, in which shift+Up/Down are used for selection, cmd⌘+c and cmd⌘+v are used for copying and pasting. However, the cells will merge after pasting.

Is there a way to prevent the cells from merging?

meTchaikovsky
  • 7,478
  • 2
  • 15
  • 34

2 Answers2

10

Thanks for the tips. I tried and found the way not to merge:

  1. Press esc key (command mode, the area will turn to blue), 2) use shift+up/down to choose(all turn to blue area) 3) cmd⌘+c to copy
  2. Another notebook( you will paste), also press esc key first( that's how not merge) and cmd⌘+v to paste the multi cells, you will get multi cells, including outputs.
Elizabeth Shen
  • 168
  • 2
  • 9
3

The cells do not seem to merge, using Jupyter Lab version 2.1.5.

  • Click on the left of the top cell you'd like to copy.
  • Press the Shift key and click on the bottom cell you'd like to copy.
  • The sequence of cells should be highlighted now (in light blue with the usual theme)
  • Press the C key to copy
  • Select the cell above the cell you want the new cells to appear.
  • Press the V key to paste

Result (note that the new cells will have numbers matching the old ones):

enter image description here

ELinda
  • 2,658
  • 1
  • 10
  • 9
  • Thank you for your answer, but I'm using jupyter notebook and this doesn't work in jupyter notebook ...... – meTchaikovsky Oct 13 '20 at 03:46
  • Jupyter Lab is installed with recent versions of Conda -- try using that if you are able to – ELinda Oct 13 '20 at 16:28
  • im not sure this helps, but i was able to copy multiple cells in jupyter in vscode in windows using ctrl+left click on the cell's left side, then ctrl+c all of the selection, creating a new cell and then ctrl+v at the left side of that new cell – Abdul-Kareem Abdul-Rahman Apr 15 '23 at 16:27