onBeforePaste

fires before data is pasted

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 whether the copied data come from the same sheet they are pasted into
contextobjecta context object of the copy operation with the page (the origin of the copied data) and view (the SpreadSheet instance the data come from) properties
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 the following optional properties: row, col, condition, dropdown, filter, span, validation
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.