Bulk Adding / Updating via CSV
With the Zoho Reports API, you can add/update data in bulk. The data to be added/updated should be in a CSV file format.
Note:
- The CSV should contain the column names in the first row.
- The data should be sent via a http POST request
- The parameters and the file should be encoded in multi-part/form-data format.(The format used by html forms that contain file type fields used for uploading files)
Sample
URL
http://reports.zoho.com/api/demouser/EmployeeDB/EmployeeDetails?ZOHO_ACTION=IMPORT
&ZOHO_OUTPUT_FORMAT=XML&ZOHO_ERROR_FORMAT=XML
&ZOHO_API_KEY=adss&ticket=ssfs&ZOHO_API_VERSION=1.0
Data Sent as POST parameters.
The additional control parameters and the file should be encoded in multi-part/form-data format (The format used by html forms that contain file type fields used for uploading files).
Following code snippet helps to import data into Zoho Reports with POST parameters along with additional control parameters submitted from the HTML form.
<html>
<body>
<form name="ZohoDBImportForm" ENCTYPE="multipart/form-data" method="post" action="http://reports.zoho.com/api/demouser/EmployeeDB/EmployeeDetails?ZOHO_ACTION=IMPORT
&ZOHO_API_KEY=adss&ZOHO_API_VERSION=1.0&ticket=ssfs
&ZOHO_OUTPUT_FORMAT=XML">
<input type="file" name="ZOHO_FILE" value="Browse"><br>
ZOHO IMPORT TYPE : <input type="text" name="ZOHO_IMPORT_TYPE" value="APPEND"><br>
ZOHO AUTO IDENTIFY : <input type="text" name="ZOHO_AUTO_IDENTIFY" value="true"><br>
ZOHO CREATE_TABLE : <input type="text" name="ZOHO_CREATE_TABLE" value="false"><br>
ON IMPORT ERROR : <input type="text" name="ZOHO_ON_IMPORT_ERROR" value="ABORT"><br>
<input type="submit" name="submit" value="Upload">
</body>
</html>
Specifying the action
In the query string of the url , the ZOHO_ACTION parameter should be "IMPORT". For other mandatory query string parameters such as ZOHO_OUTPUT_FORMAT, refer this link.
Note: Value of ZOHO_ACTION parameter should be in the same case(UPPER CASE) as given in this document.
Parameters for specifying the Import Options
These parameters are used to specify the various options when importing. Some of these parameters are mandatory and are highlighted and marked with star " * " .
|
Parameter
|
Possible Values
|
Description
|
CSV Format Details
These parameters need to be specified if the ZOHO_AUTO_IDENTIFY is set to false.
|
Parameter
|
Possible Values
|
Description
|
Sample Success Response
XML
<?xml version="1.0" encoding="UTF-8" ?>
<response uri="/api/demouser/EmployeeDB/EmployeeDetails" action="IMPORT">
<result>
<importSummary>
<totalColumnCount>3</totalColumnCount>
<selectedColumnCount>3</selectedColumnCount>
<totalRowCount>50</totalRowCount>
<successRowCount>48</successRowCount>
<warnings>0</warnings>
<importOperation>created</importOperation>
<importType>APPEND</importType>
</importSummary>
<columnDetails>
<column datatype="Plain Text">Name</column>
<column datatype="Date">Date Of Birth</column>
<column datatype="Number">Salary</column>
</columnDetails>
<!-- The first 100 errors are alone sent -->
<importErrors>
[Line: 5 Field: 3] a1213 -WARNING: Invalid Number value
</importErrors>
</result>
</response>
JSON
{
"response":
{
"uri": "/api/demouser/EmployeeDB/EmployeeDetails",
"action": "IMPORT",
"result":
{
importSummary:
{
totalColumnCount:3,
selectedColumnCount:3,
totalRowCount:50,
successRowCount:48,
warnings:0,
importOperation: "created",
importType: "APPEND"
},
columnDetails:
{
"Name": "Plain Text",
"Date Of Birth": "Date",
"Salary": "Number"
},
importErrors: "[Line: 5 Field: 3] a1213 -WARNING: Invalid Number value"
}
}
}
Is it possible to build a CSV string in VB.Net and bulk upload that way via POST methods? Saves an windows application builder creating a separate process of saving a file to the computer.