Here's my current solution. It inserts a blank area the size of the selection, and shifts the relevant rows downward by one selection-height. The next step is to make it a full-fledged "insert copied cells" feature.
/* NOTE: THIS function does not preserve the semantics of formulas which point at the
moved data.
In this way it is more disruptive than cut-and-paste,
which retargets references in existing formulas
*/
function shiftCellsDown(){
var SS = SpreadsheetApp.getActiveSpreadsheet();
var sheet = SS.getActiveSheet();
var selection = sheet.getActiveSelection();
var selectedRow = selection.getRowIndex();
var selectedCol = selection.getColumnIndex();
var lastRow = sheet.getLastRow();
var width = selection.getWidth();
var height = selection.getHeight();
var rangeToBeMoved =sheet.getRange(selectedRow, selectedCol, lastRow-selectedRow+height, width);
var dataToBeMoved = rangeToBeMoved.getValues();
var row = [];
for ( var c =0; c< width; c++){
row.push("");
}
for ( var r =0; r< height; r++){
dataToBeMoved.splice(0,0,row);
}
sheet.getRange(selectedRow, selectedCol, dataToBeMoved.length,width).setValues(dataToBeMoved);
}
I will assume you're not using Chrome, which is why my answer is relevant.
Check out this article on copy/pasting in Google Drive documents:
When working in Chrome, you can use the right-click menu to copy and paste content (or select "Copy" or "Paste" from the Edit menu in the toolbar).
When using the right-click-context menu in Drive, the stuff you cut/copy/paste is stored in a different place (in Chrome). Therefore, if not using Chrome, you won't be able to use the menu options. The keyboard shortcuts still work because those pieces are stored elsewhere (on the system clipboard, not browser).
Update: a little more context - Chrome uses its own web clipboard. Why? I'm not 100% certain but I think it's so that you can preserve things when pasting across files or apps (like Spreadsheets to Documents, etc) which you can't do with the traditional system clipboard. Since the context-menu is also native to the app that it's running (in this case your Drive and Chrome are all connected together), the context-menu will behave differently when used in Firefox. This is because those specific options are looking to access the Chrome clipboard, which it cannot.
My answer becomes even more conjecture at this point: I would bet that the Ctrl+C event is overwritten in Chrome to copy/cut to the Chrome clipboard, but would naturally default to the system clipboard if not in Chrome. The context-menu doesn't behave the same way because, well, I have no idea :) Might be something to bring up in a product forum though...
Best Answer
At this time right click shows a context menu that include paste as an option. Just do right click over an editable area in a document, spreadsheet or presentation.