postMessage API List

The postMessage APIs are broadly divided into major categories:

Note: To enable postMessage APIs, you need to register your domain(s) with us. Please refer to this link to know how to allow or add your postMessage domain list.

Send Messages to Sheet iFrame

Under the send message section, you can post content, export and save spreadsheets from your host page.

The list of send message methods and their categories are tabulated below:

Content

Document

Content

Insert Cell Content

Purpose: To insert the cell content from your web application's host page to Zoho Sheet iFrame.

XDC.postMessage ( {
  "message": "CellContent",
  "data": {
    "row": <int>,
    "col": <int>,
    "content": <string>
  },
  // Use "CellContentResponse" event for oncomplete
  "onexception": function(data) {
    // Handle exception
  }
} );

Document

Export Spreadsheet

Purpose: To "export" the Sheet document.

XDC.postMessage ( {
  "message": "ExportSpreadsheet",
  "data": {
    "format": <String>
  },
  // Use "ExportSpreadsheetResponse" event for oncomplete
  "onexception": function(data) {
    // Handle exception
  }
} );

Save Spreadsheet

Purpose: To "save" the Sheet document.

XDC.postMessage ( {
  "message": "SaveSpreadsheet",
  // Use "SaveSpreadsheetResponse" event for oncomplete
  "onexception": function(data) {
    // Handle exception
  }
} );

Receive Messages from Sheet iFrame

Under the receive message section, you can obtain multiple notifications about spreadsheet status from Sheet iFrame to your host page.

The list of receive message methods and their categories are tabulated below:

Document

Document

Spreadsheet Load In Progress

Purpose: To receive the "Spreadsheet Load In Progress" notification from Sheet iFrame to the host page.

XDC.receiveMessage("SpreadsheetLoadInProgress", function(data) {
  console.log(data);
} );

Spreadsheet Load Complete

Purpose: To receive the "Spreadsheet Load Complete" notification from Sheet iFrame to the host page.

XDC.receiveMessage("SpreadsheetLoadComplete", function(data) {
  console.log(data);
} );

Spreadsheet Modified

Purpose: To receive the "Spreadsheet Modified" notification from Sheet iFrame to the host page.

XDC.receiveMessage("SpreadsheetModified", function(data) {
  console.log(data);
} );

Save Spreadsheet Response

Purpose: To receive a save spreadsheet response from Sheet iFrame to the host page.

XDC.receiveMessage("SaveSpreadsheetResponse", function(data) {
  console.log(data);
} );