Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I copy multiple cells from one notebook to another at once (the cells should not merge after pasting)

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?

like image 832
meTchaikovsky Avatar asked Jan 01 '26 08:01

meTchaikovsky


2 Answers

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.
like image 150
Elizabeth S Avatar answered Jan 04 '26 20:01

Elizabeth S


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

like image 24
ELinda Avatar answered Jan 04 '26 22:01

ELinda



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!