onBeforePaste

fires before data pasting

boolean onBeforePaste(object start,object end,array data,boolean fromSheet,object context);
startobjectan object with the start cell of the selected area (target of paste) set as {row:id, column:id}
endobjectan object with the end cell of the selected area (target of paste) set as {row:id, column:id}
dataarrayan array of cells with data that were copied (a 2D (two-dimensional) array of rows with cells)
fromSheetbooleansignals if the copied data are from the same sheet where they are pasted into
contextobjecta context object of the copy operation which has page (the origin of the copied data) and view (the instance of spreadsheet, also the origin of the data)
booleanreturning false will prevent pasting of copied data

Example

$$("ssheet1").attachEvent("onBeforePaste",function(start,end,data,fromSheet,context){
    // handler code here
    return true;
});

Details

Each cell in the data array parameter includes:

  • text - a string returned by getCellValue()
  • math - a string with the formula or null
  • style - an object with the style of the cell
  • extra - optional, contains: row, col, condition, dropdown, filter, span, validation - all optional
Back to top
Join Our Forum
We've retired comments here. Visit our forum for faster technical support, connect with other developers, and share your feedback there.