Merge and store document

Merge and store document in Zoho Writer


The zoho.writer.mergeAndStore task supplies values to the merge fields inserted to a document, and stores the new merged documents converted into a single file in the specified Zoho Docs folder.

This integration task is based on the Zoho Writer API - Merge and store.

Note: On average, it takes about a minute to index a file/folder after it is created or updated. This indexing time can increase if the queue size increases. You will not get the expected result if you execute zoho.writer.mergeAndStore task before the document you need to merge is indexed.


<response> = zoho.writer.mergeAndStore(<document_id>, <values_map>, <output_settings>, <connection>);
ParamsData typeDescription



The response that represents the document ID and document URL.



The ID of the source document that will be merged with values.

The document ID can be obtained from the URL of the source document. The URL is in the following format:<document_id>



The values that will be supplied to the merge fields.

Note: Keys for this parameter should be the names of the merge fields inserted in the document. To fetch the names of the merge fields, you can use Zoho Writer's get merge fields integration tasks.



Other output settings like the folder in which the new merged documents will be stored, the name of the new merged document, etc.

Note: Keys for this parameter should be supplied as specified in Zoho Writer API document listed under output_settings param.



The link name of the connection.


  • In view of stopping new authtoken generation, a Zoho OAuth connection with appropriate scopes is mandatory in order for new integration tasks (created after the deadline specified in the post) to work as expected. Existing integration tasks will continue to work with or without the connections parameter until you manually delete the authtoken from accounts.
  • Add relevant scopes mentioned in Zoho Writer API while creating the connection.
  • Refer to this post for the list of Zoho services that support the connections page.
  • Learn more about connections

Example: Supply data to the merge field and store the new document in the specified folder

The following script supplies the data stored in the KEY-VALUE variable - data_map to the merge fields present in the document of ID - al296XXXXXXXXXXXXXXXXXXXXXXXXXXXa516c, and stores the file in the specified Zoho Docs folder.

 // Construct a KEY-VALUE variable to hold the merge data

 values_map = Map();
 values_map.put("Name", "Shawn");
 // Construct a KEY-VALUE variable to hold the output settings
 output_settings = Map();
 output_settings.put("doc_name", "New merged document");
 output_settings.put("folder_id", "5rh8dXXXXXXXXXXXXXXXXXXXXXXXXXXX98bbc");
 // Perform the Merge and store task
 response = zoho.writer.mergeAndStore("al296XXXXXXXXXXXXXXXXXXXXXXXXXXXa516c", values_map, output_settings, "writer_oauth_connection");


The KEY-VALUE response that represents the document ID and URL.
The TEXT that represents the ID of the document.
The KEY-VALUE variable that holds the merge data.
The KEY-VALUE variable that holds the name of the new document and the ID of the Zoho Docs folder in which the new merged document will be stored.
The TEXT that represents the name of the connection.
The TEXT keys that as specified in the Zoho Writer API.

Response Format

Success Response

  • The success response will be returned in the following format:


Failure Response

  • The failure response for incorrect document ID will be returned in the following format:

     "error": {
     "message": "Permission denied. You are not authorized to perform this operation.",
     "documentation_url": "",
     "response_generated_time": 1588604646315,
     "request_url": "",
     "errorcode": "R5010"

Related Links

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: