Skip to product menu
close
  • Recent Launches
    Press Space or Enter to display list of options
EXPLORE ALL PRODUCTS

Recent Launches

New

Payroll software with automated tax payments and filing.

Try now
New

Robotic process automation software to automate high-volume, rule-based tasks.

Try for free
New

Low-code IoT platform and solutions for connected businesses.

Try now
New

Business formation service to launch and grow your businesses.

Try now
New

Privacy-friendly application analytics solution.

Try for free

Sales

 
CRM

Comprehensive CRM platform for customer-facing teams.

CRM
 
Bigin

Simple CRM for small businesses moving from spreadsheets.

Bigin
 
Forms

Build online forms for every business need.

Forms
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
Sign

Digital signature app for businesses.

Sign
 
RouteIQ

Comprehensive sales map visualization and optimal route planning solution.

RouteIQ
 
Thrive

Complete loyalty and affiliate management platform.

Thrive
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
Suites
CRM Plus

Unified platform to deliver top-notch customer experience.

CRM Plus

Marketing

 
Social

All-in-one social media management software.

Social
 
Campaigns

Create, send, and track targeted email campaigns that drive sales.

Campaigns
 
Forms

Build online forms for every business need.

Forms
 
Survey

Design surveys to reach and interact with your audience.

Survey
 
Sites

Online website builder with extensive customisation options.

Sites
 
PageSense

Website conversion optimization and personalisation platform.

PageSense
 
Backstage

End-to-end event management software.

Backstage
 
Webinar

Webinar platform for webcasting online webinars.

Webinar
 
Marketing Automation

All-in-one marketing automation software.

Marketing Automation
 
LandingPage

Smart landing page builder to increase conversion rates

LandingPage
 
Publish

Manage all your local business listings on a single platform.

Publish
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Sign

Digital signature app for businesses.

Sign
 
Thrive

Complete loyalty and affiliate management platform.

Thrive
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
NEW
LeadChain

Sync, manage, and convert leads across channels seamlessly.

LeadChain
 
NEW
CommunitySpaces

Online community platform for individuals and businesses to grow their network and brand.

CommunitySpaces
 
Suites
Marketing Plus

Unified marketing platform for marketing teams.

Marketing Plus

Commerce and POS

 
Commerce

eCommerce platform to manage and market your online store.

Commerce

Service

 
Desk

Helpdesk software to deliver great customer support.

Desk
 
Assist

Remote support and unattended remote access software.

Assist
 
Lens

Interactive remote assistance software with augmented reality.

Lens
 
FSM

End-to-end field service management platform for service businesses.

FSM
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
Suites
Service Plus

Unified platform for customer service and support teams.

Service Plus

Finance

 
Books

Powerful accounting platform for growing businesses.

Books
 
FREE
Invoice

100% Free invoicing solution.

Invoice
 
Expense

Effortless expense reporting platform.

Expense
 
Inventory

Powerful stock management and inventory control software.

Inventory
 
Billing

End-to-end billing solution for your business.

Billing
 
Checkout

Collect payments online with custom branded pages.

Checkout
 
NEW
Payroll

Payroll software with automated tax payments and filing.

Payroll
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo
 
Practice

Practice management software for accounting firms.

Practice
 
Sign

Digital signature app for businesses.

Sign
 
Commerce

eCommerce platform to manage and market your online store.

Commerce
 
Suites
Finance Plus

All-in-one suite to manage your operations and finances.

Finance Plus

Email and Collaboration

 
Mail

Secure email service for teams of all sizes.

Mail
 
Meeting

Online meeting software for all your video conferencing & webinar needs.

Meeting
 
Writer

Word processor for focused writing and discussions.

Writer
 
Sheet

Spreadsheet software for collaborative teams.

Sheet
 
Show

Create, edit, and share slides with a sleek presentation app.

Show
 
Notebook

Beautiful home for all your notes.

Notebook
 
Cliq

Stay in touch with teams no matter where you are.

Cliq
 
Connect

Employee experience platform to communicate, engage, and build positive employee relations.

Connect
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
TeamInbox

Shared inboxes for teams.

TeamInbox
 
WorkDrive

Online file management for teams.

WorkDrive
 
Sign

Digital signature app for businesses.

Sign
 
Office Suite

Powerful collaborative work platform for teams.

Office Suite
 
Office Integrator

Built in document editors for web apps.

Office Integrator
 
ZeptoMail

Secure and reliable transactional email sending service.

ZeptoMail
 
Calendar

Online business calendar to manage events and schedule appointments.

Calendar
 
Learn

Knowledge and learning management platform.

Learn
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
ToDo

Collaborative task management for individuals and teams.

ToDo
 
Tables

Work management tool to connect people, processes, and information.

Tables
 
FREE
PDF Editor

Collaborative online PDF editing tool.

PDF Editor
 
Suites
Workplace

Application suite built to improve team productivity and collaboration.

Workplace

Human Resources

 
People

Organize, automate, and simplify your HR processes.

People
 
Recruit

Intuitive recruiting platform built to provide hiring solutions.

Recruit
 
Expense

Effortless expense reporting platform.

Expense
 
Workerly

Manage temporary staffing with an employee scheduling solution.

Workerly
 
NEW
Payroll

Payroll software with automated tax payments and filing.

Payroll
 
Shifts

Employee scheduling and time tracking app.

Shifts
 
Sign

Digital signature app for businesses.

Sign
 
Suites
People Plus

Comprehensive HR platform for seamless employee experiences.

People Plus

Security and IT Management

 
Creator

Build custom apps to simplify business processes.

Creator
 
Directory

Workforce identity and access management solution for cloud businesses.

Directory
 
FREE
OneAuth

Secure multi-factor authenticator (MFA) for all your online accounts.

OneAuth
 
Vault

Online password manager for teams.

Vault
 
Catalyst

Pro-code platform to build and deploy your apps.

Catalyst
 
Toolkit

Complete resource for any admin-related lookup queries.

Toolkit
 
Lens

Interactive remote assistance software with augmented reality.

Lens
 
Assist

Remote support and unattended remote access software.

Assist
 
QEngine

Test automation software to build, manage, execute, and report testcases.

QEngine
 
NEW
RPA

Automate manual, tedious, and repetitive tasks easily.

RPA

BI and Analytics

 
Analytics

Modern self-service BI and analytics platform.

Analytics
 
Embedded BI

Embedded analytics and white label BI solutions, tailored for your needs.

Embedded BI
 
DataPrep

AI-powered data preparation service for your data-driven organization.

DataPrep
 
NEW
IoT

Harnessing IoT analytics for real-time operational intelligence.

IoT

Project Management

 
Projects

Manage, track, and collaborate on projects with teams.

Projects
 
Sprints

Planning and tracking tool for scrum teams.

Sprints
 
BugTracker

Automatic bug tracking software for managing bugs.

BugTracker
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo

Developer Platforms

 
Creator

Build custom apps to simplify business processes.

Creator
 
Flow

Automate business workflows by creating smart integrations.

Flow
 
Catalyst

Pro-code platform to build and deploy your apps.

Catalyst
 
Office Integrator

Built in document editors for web apps.

Office Integrator
 
ZeptoMail

Secure and reliable transactional email sending service.

ZeptoMail
 
QEngine

Test automation software to build, manage, execute, and report testcases.

QEngine
 
Tables

Work management tool to connect people, processes, and information.

Tables
 
NEW
RPA

Automate manual, tedious, and repetitive tasks easily.

RPA
 
NEW
Apptics

Application analytics for all apps.

Apptics
 
Embedded BI

Embedded analytics and white label BI solutions, tailored for your needs.

Embedded BI
 
NEW
IoT

Build, deploy, and scale IoT solutions for connected businesses.

IoT
 
DataPrep

AI-powered data preparation service for your data-driven organization.

DataPrep

IoT

 
NEW
IoT

Low-code IoT platform and solutions for connected businesses.

IoT

Search Result

 
CRM Plus

Unified platform to deliver top-notch customer experience.

Try now
CRM Plus
 
Service Plus

Unified platform for customer service and support teams.

Try now
Service Plus
 
Finance Plus

All-in-one suite to manage your operations and finances.

Try now
Finance Plus
 
People Plus

Comprehensive HR platform for seamless employee experiences.

Try now
People Plus
 
Workplace

Application suite built to improve team productivity and collaboration.

Try now
Workplace
 
Marketing Plus

Unified marketing platform for marketing teams.

Try now
Marketing Plus
 
All-in-one suite

Zoho One

The Operating System for Business

Run your entire business on Zoho with our unified cloud software, designed to help you break down silos between departments and increase organizational efficiency.

TRY ZOHO ONE
Zoho One
Zoho Marketplace

With over 2000 ready-to-use extensions across 40+ categories, connect your favorite business tools with the Zoho products you already use.

EXPLORE MARKETPLACE
Marketplace

Join us for the biggest low-code event of the year. Register now!

x
Skip to main content

Choose where you’d like to start

Merge and Send Documents in Zoho Writer

Description

The zoho.writer.mergeAndSend task supplies values to the merge fields inserted to a document, and sends the new merged documents individually to the specified email ID. The values of the merge fields are provided from a data source of type CSV or JSON

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

Note:
  • The merge fields inserted into the document should be the column headers of a CSV data source, or the keys in a JSON data source.
  • 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.mergeAndSend task before the document you need to merge is indexed.

Syntax

<response> = zoho.writer.mergeAndSend(<document_id>, <output_format>, <email_id>, <values_map>, <connection>);
where:

 

ParamsData typeDescription

<response>

KEY-VALUE

The response returned by Zoho Writer. It represents the merge fields data of the new merged documents.

<document_id>

TEXT

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:
https://writer.zoho.com/writer/open/<document_id>

<output_format>

TEXT

The output format of the new documents that will be sent through email.

Allowed values:

  • inline - The merged document is sent in the email body.
  • pdf - The merged document is sent as an email attachment in .pdf format.
  • docx - The merged document is sent as an email attachment in .docx format.

<email_id>

TEXT

The email address of the recipient to whom the individual documents will be sent.

<values_map>

KEY-VALUE

The values that will be supplied to the merge fields. The values can be fetched only from CSV file or JSON file/text.

Note: The keys of this parameter should be specified as given in the Zoho Writer API. Applicable keys and values for CSV and JSON data as specified in Zoho Writer API:

CSV:

  • Specify the file URL
    key: merge_data_csv_url
    value: The TEXT that represents the URL of the CSV file.
  • Specify values stored in a file object 
    key: merge_data_csv_content
    value: The FILE that contains the merge values.

JSON:

  • Specify the file URL
    key: merge_data_json_url
    value: The TEXT that represents the URL of the JSON file.
  • Specify values stored in a file object 
    key: merge_data_json_content
    value: The FILE that contains the merge values.
  • Specify the text directly
    key: merge_data
    value: The TEXT/ KEY-VALUE that represents the JSON value. The key for the JSON value needs to be "data".

Optional keys:

  • Specify the subject of the email
    key: subject
    value: The TEXT value associated with this key specifies the subject of the email that needs to be sent.

<connection>

TEXT

The link name of the connection.

Note:

  • 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 1: Supply CSV content to the merge fields and email the new merged documents

The following script supplies the CSV data stored in the FILE variable - csv_content to the merge fields present in the specified documents, and sends the new merged documents to the email address - shawn@zylker.com:

 // Fetch the CSV data from the web and store it in the variable - csv_content
 csv_content =  invokeurl 
 [
 url : "http://insight.dev.schoolwires.com/HelpAssets/C2Assets/C2Files/C2ImportCalEventSample.csv"
 type : GET
 ];
 
 
 // Construct a KEY-VALUE variable to hold the merge data and subject of the email
 merge_values = Map();
 merge_values.put("subject", "Merge and send Deluge task");
 merge_values.put("merge_data_csv_content", csv_content);
 
 
 // Perform the Merge and Send task 
 response = zoho.writer.mergeAndSend("al296XXXXXXXXXXXXXXXXXXXXXXXXXXXa516c", "inline", "shawn@zylker.com", merge_values, "writer_oauth_connection");

where:

response
The KEY-VALUE response returned by Zoho Writer. It represents the merge fields data of the new merged documents.
"al296XXXXXXXXXXXXXXXXXXXXXXXXXXXa516c"
The TEXT that represents the document ID of the source document.
"shawn@zylker.com"
The TEXT that represents the email address of the recipient to whom the new documents will be sent.
merge_value
The KEY-VALUE variable that holds the merge data, and the subject of the email that will be sent.
"writer_oauth_connection"
The TEXT that represents the name of the connection.
"merge_data_csv_content"
The TEXT key that represents the type of data source. Here, the data source is a FILE that contains CSV data.
csv_content
The FILE variable that holds the CSV data that will be supplied to the merge fields.
Note: The CSV data is fetched from the cloud using the invoke URL task. To learn more about the invokeUrl task, click here.

Example 2: Supply CSV data from a URL to the merge fields and email the new merged documents

The following script supplies CSV values fetched from the specified URL to the merge fields present in the specified documents, and sends the new merged documents to the email address - shawn@zylker.com:

 // Construct a KEY-VALUE variable to hold the merge data and subject of the email
 merge_values = Map();
 merge_values.put("subject", "Merge and send Deluge task");
 merge_values.put("merge_data_csv_url", "http://insight.dev.schoolwires.com/HelpAssets/C2Assets/C2Files/C2ImportCalEventSample.csv");
 
 
 // Perform the Merge and Send task 
 response = zoho.writer.mergeAndSend("al296XXXXXXXXXXXXXXXXXXXXXXXXXXXa516c", "inline", "shawn@zylker.com", merge_values, "writer_oauth_connection");

where:

"merge_data_csv_url"
The TEXT key that represents the type of the data source. Here, the data source is a URL that contains CSV data.
"http://insight.dev.schoolwires.com/HelpAssets/
C2Assets/C2Files/C2ImportCalEventSample.csv"
The TEXT that represents the URL of the data source.

Example 3: Supply JSON content in TEXT format to the merge fields and email the new merged documents

The following script supplies JSON values held by the variable - json_text to their respective merge fields, and sends the new documents to the email address - shawn@zylker.com:

 // Assign the JSON data in TEXT format to the variable - json_text
 json_text = "{\"data\":[{\"Name\":\"Shawn\",\"Age\":\"20\"},{\"Name\":\"Kate\",\"Age\":\"29\"}]}";
 
 
 // Construct a KEY-VALUE variable to hold the merge data and subject of the email
 merge_values = Map();
 merge_values.put("subject", "Merge and send Deluge task");
 merge_values.put("merge_data", json_text);
 
 
 // Perform the Merge and Send task 
 response = zoho.writer.mergeAndSend("al296XXXXXXXXXXXXXXXXXXXXXXXXXXXa516c", "inline", "shawn@zylker.com", merge_values, "writer_oauth_connection");

where:

"merge_data"
The TEXT key that represents the type of the data source. Here, the data source is JSON data in TEXT format
json_text
The TEXT variable that holds the JSON data that will be supplied to the merge fields. Here, the JSON array value needs to be associated with the key "data".

Response Format

Success Response

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

      {
      "merge_report_data_url": "https://docs.zoho.com/writer/api/v1/merge/job/f0b49XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXde0e1/data",
      "merge_report_url": "https://docs.zoho.com/writer/v1/mailmerge/job/f0b49XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXde0e1",
      "records": [
      {
      "Event Description": "Department meeting",
      "Category": "2",
      "All Day Event": "N",
      "Contact Phone": "814-555-5179",
      "Last Date To Register": "9/2/2011",
      "Start Time": "3:00:00 PM",
      "Event Title": "Social Studies Dept. Meeting",
      "Contact": "Chris Gallagher",
      "Contact Email": "cgallagher@schoolwires.com",
      "Maximum": "25",
      "Start Date": "9/5/2011",
      "No End Time": "Y",
      "End Date": "9/5/2011",
      "Registration": "N",
      "End Time": "",
      "Location": "High School",
      "Mandatory": "N",
      "status": "inprogress"
      },
      {
      "Event Description": "Curriculum Meeting",
      "Category": "2",
      "All Day Event": "N",
      "Contact Phone": "814-555-5179",
      "Last Date To Register": "9/2/2011",
      "Start Time": "6:00:00 PM",
      "Event Title": "Curriculum Meeting",
      "Contact": "Chris Gallagher",
      "Contact Email": "cgallagher@schoolwires.com",
      "Maximum": "25",
      "Start Date": "9/5/2011",
      "No End Time": "N",
      "End Date": "9/5/2011",
      "Registration": "N",
      "End Time": "8:00:00 PM",
      "Location": "High School",
      "Mandatory": "N",
      "status": "inprogress"
      }
      ]
      }

Failure Response

  • The failure response for empty merge data will be returned in the following format:

      {
      "error": {
      "error": {
      "documentation_url": "https://www.zoho.com/writer/help/api/v1/general-errors.html",
      "message": "Merge data not found. Please try again with proper merge data.",
      "errorcode": "1837"
      }
      }
  • The failure response when you try to share a document that is not owned or co-owned by you will be returned in the following format:

      {
      "error": {
      "message": "Permission denied. You are not authorized to perform this operation.",
      "documentation_url": "https://www.zoho.com/writer/help/api/v1/general-errors.html",
      "response_generated_time": 1563961602526,
      "request_url": "https://writer.zoho.com/api/v1/documents/al296XXXXXXXXXXXXXXXXXXXXXXXX6964add/collaboration",
      "errorcode": "R5010"
      }
      }
  • The failure response for incorrect email address will be returned in the following format:

      {
      "error": {
      "parameter_name": "recipient_email",
      "message": "Invalid parameter values found. Please try again with supported values.",
      "documentation_url": "https://www.zoho.com/writer/help/api/v1/general-errors.html",
      "response_generated_time": 1564637379763,
      "request_url": "https://writer.zoho.com/writer/api/v1/documents/al296XXXXXXXXXXXXXXXXXXXXXXXXXXXb4add/merge/email",
      "errorcode": "R2000"
      }
      }
  • The failure response for improper document ID will be returned in the following format:

      {
      "error": {
      "message": "Request URL not configured properly. Please check and try again",
      "documentation_url": "https://www.zoho.com/writer/help/api/v1/general-errors.html",
      "response_generated_time": 1563961624177,
      "request_url": "https://writer.zoho.com/api/v1/documents//collaboration",
      "errorcode": "R2008"
      }
      }
  • The failure response when you try to merge values to a document that you do not have permission will be returned in the following format:

      {
      "error": {
      "message": "Permission denied. You are not authorized to perform this operation.",
      "documentation_url": "https://www.zoho.com/writer/help/api/v1/general-errors.html",
      "response_generated_time": 1563961602526,
      "request_url": "https://writer.zoho.com/api/v1/documents/al296XXXXXXXXXXXXXXXXXXXXXXXX6964add/collaboration",
      "errorcode": "R5010"
      }
      }

Related Links

Get Started Now

Execute