Ever wanted to run a Levenshtein Distance algorithm inside Zoho Deluge? No? Me neither, but I did it anyway.
I built a fully functional fuzzy matching system inside Zoho, brute-forcing a dynamic programming solution using Maps and recursive list generation.
- Does it scale? Not really.
- Does it work? Absolutely.
- Did I need to do this? Not at all, but it was fun.
I don’t even use this anymore because I found a better way around fuzzy matching for my needs, but hey, if you ever need a low volume Levenshtein calculator inside Zoho, now you have one. 🤷♂️
How It Works
The function computes Levenshtein Distance, a metric for fuzzy string similarity, by calculating the number of insertions, deletions, and substitutions needed to convert one string into another.
This method is commonly used in spell-checking, DNA sequencing, and fuzzy search algorithms—so obviously, I decided to implement it inside Zoho, because why not?
🔹 The Challenge: Zoho doesn’t support 2D arrays natively.
🔹 The Solution: I brute-forced it using Map-of-Maps as a manual matrix.
🔹 Bonus: I even used recursion to generate number sequences (which is completely unnecessary but kinda cool).
Code & Example Usage
Main Function: standalone.levenshteinDistance
📌 Input: {"s": "kitten", "t": "sitting"}
📌 Output: "3"
Code:
string standalone.levenshteinDistance(Map args)
{
// Retrieve input strings.
s = args.get("s");
t = args.get("t");
m = s.length();
n = t.length();
// If one string is empty, return the length of the other.
if(m == 0)
{
return n.toString();
}
if(n == 0)
{
return m.toString();
}
//info "Length of s: " + m.toString() + ", Length of t: " + n.toString();
// ------------------------------
// Get index lists via the helper function.
// The helper function standalone.UtilitygetListOfLength returns a comma-separated string.
// For example, if (m+1) is 5, it returns "0,1,2,3,4".
// ------------------------------
indices_m_str = standalone.UtilitygetListOfLength({"myLength":m + 1});
indices_n_str = standalone.UtilitygetListOfLength({"myLength":n + 1});
//info "indices_m_str: " + indices_m_str;
//info "indices_n_str: " + indices_n_str;
// Convert these comma-separated strings into lists of long values.
indices_m = list();
numList_m = indices_m_str.toList(",");
for each numStr in numList_m
{
if(numStr.trim() != "")
{
indices_m.add(numStr.trim().toLong());
}
}
indices_n = list();
numList_n = indices_n_str.toList(",");
for each numStr in numList_n
{
if(numStr.trim() != "")
{
indices_n.add(numStr.trim().toLong());
}
}
//info "indices_m list: " + indices_m.toString();
//info "indices_n list: " + indices_n.toString();
// ------------------------------
// Initialize matrix as a map-of-maps.
// Each row is a map keyed by the column index.
// ------------------------------
matrix = Map();
for each i in indices_m
{
rowMap = Map();
for each j in indices_n
{
rowMap.put(j,0);
}
matrix.put(i,rowMap);
}
// Set up the first column: matrix[i][0] = i.
for each i in indices_m
{
rowMap = matrix.get(i);
rowMap.put(0,i);
}
// Set up the first row: matrix[0][j] = j.
firstRow = matrix.get(0);
for each j in indices_n
{
firstRow.put(j,j);
}
// ------------------------------
// Compute Levenshtein distances.
// ------------------------------
for each i in indices_m
{
if(i == 0)
{
continue;
}
for each j in indices_n
{
if(j == 0)
{
continue;
}
// Determine cost: 0 if characters are the same, otherwise 1.
if(s.subString(i - 1,i) == t.subString(j - 1,j))
{
cost = 0;
}
else
{
cost = 1;
}
deletion = matrix.get(i - 1).get(j) + 1;
insertion = matrix.get(i).get(j - 1) + 1;
substitution = matrix.get(i - 1).get(j - 1) + cost;
minValue = deletion;
if(insertion < minValue)
{
minValue = insertion;
}
if(substitution < minValue)
{
minValue = substitution;
}
rowMap = matrix.get(i);
rowMap.put(j,minValue);
}
}
result = matrix.get(m).get(n);
//info "Levenshtein distance: " + result.toString();
return result.toString();
}
Recursive Helper Function: standalone.UtilitygetListOfLength
📌 Input: {"myLength": 6}
📌 Output: "0,1,2,3,4,5"
Code:
string standalone.UtilitygetListOfLength(Map args)
{
myLength = args.get("myLength");
//info "Input myLength: " + myLength;
if(myLength == null || myLength <= 0)
{
//info "Base case reached (myLength <= 0). Returning empty string.";
return "";
}
else
{
// Recursively get the string for (myLength - 1)
prevStr = standalone.UtilitygetListOfLength({"myLength":myLength - 1});
//info "Previous string returned for myLength " + (myLength - 1).toString() + ": " + prevStr;
if(prevStr.equals(""))
{
result = "0";
}
else
{
result = prevStr + "," + (myLength - 1).toString();
}
//info "Returning result for myLength " + myLength.toString() + ": " + result;
return result;
}
}
This helper function is completely unnecessary, but I made it anyway. Instead of just looping, it recursively builds a CSV string of numbers—which is both inefficient and hilarious. 😆
Why Did I Do This?
Because it wasn't supposed to work—but it does.
- Zoho doesn’t support Levenshtein distance? I built it anyway.
- Zoho doesn’t have fuzzy matching? Now it does.
- Zoho doesn’t support 2D arrays? I brute-forced a matrix using Maps.
- Does this scale for massive data? Nope, but it’s perfect for low-volume cases.
Thoughts? Ideas? Have you ever done something in Zoho just because you wanted to see if it was possible? Let me know. 😆
TL;DR:
📌 I brute-forced Levenshtein Distance into Zoho
📌 Zoho wasn’t built for this, but I made it work anyway
📌 Does it scale? No. Does it work? Yes.
📌 Do I use it? Nope. Was it fun? Absolutely.
Let me know what you think! 🚀
Recent Topics
Live webinar: Mastering data migration, organization, and team collaboration
Hello everyone, We’re excited to invite you to our upcoming live webinar! Discover how to seamlessly migrate your data, optimize file organization, and boost team collaboration using Zoho WorkDrive’s powerful features. This is a fantastic opportunity
BARCODE PICKLIST
Hello! Does anyone know how the Picklist module works? I tried scanning the barcode using the UPC and EAN codes I added to the item, but it doesn’t work. Which barcode format does this module use for scanning?
Join our live webinar: Explore the WorkDrive TrueSync application!
Hello everyone, We are thrilled to invite you to a live webinar focused on mastering the WorkDrive TrueSync application. Discover how to seamlessly sync your content between the cloud and your computer, ensuring smooth and efficient file management. Our
Bug tracking
Hi, does anyone know how to track errors during picking or packing? This way I can keep track and see how to improve and prevent errors in this area.
Can the Product Image on the Quote Template be enlarged
Hello, I am editing the Quote Template and added ${Products.Product Image} to the line item and the image comes up but it is very tiny. Is there anyway that you can resize this to be larger? Any help would be great! Thanks
Zoho Creator customer portal limitation | Zoho One
I'm asking you all for any feedback as to the logic or reasoning behind drastically limiting portal users when Zoho already meters based on number of records. I'm a single-seat, Zoho One Enterprise license holder. If my portal users are going to add records, wouldn't that increase revenue for Zoho as that is how Creator is monetized? Why limit my customer portal to only THREE external users when more users would equate to more records being entered into the database?!? (See help ticket reply below.)
Script Editor not an option
I am trying to apply a script to a sheet and Script Editor is not an option. I don't want to go outside Sheets to do this (like Creator) if it can be done inside Sheets.
Send Automated WhatsApp Messages and Leverage the Improved WhatsApp Templates
Greetings, I hope all of you are doing well. We're excited to announce a major upgrade to Bigin's WhatsApp integration that brings more flexibility, interactivity, and automation to your customer messaging. WhatsApp message automation You can now use
Envio de mails
Hola! No puedo enviar mails pero si recibirlos. No se como solucionarlo! Mi dominio es chidobebes.com.ar
ERROR CODE :554 - Your access to this mail system has been rejected due to poor reputation of a domain used in message transfer
In my email configuration: The domain's MX Records are pointed to Zoho The domain's SPF Records have been pointed out successfully DKIM is enabled. DMARC Record is pointed for the domain. The domain name is digioorja.in. Still facing the issue of Error:
This Operation has been restricted. Please contact support-as@zohocorp.com for further details
l tried to verify my domain (casalimpaeperfumada.com.br) and its shows this error: This Operation has been restricted. Please contact support-as@zohocorp.com for further details.
SLOW EMAILS
Is there an issue with the Zoho server? For two days now I've been having issues with very long buffering. Please advise. Thank you.
POP3 authentication error - SOLVED
Just in case others are as forgetful as me ... As Zoho has changed the POP server for personal and free organisational users, I needed to change the POP server on my email client. This failed persistently but eventually I remembered that I had chosen
Solution to Import PST File into Office 365.
MailsDaddy OST to Office 365 Migration Tool is an outstanding solution to recover OST files and migrate them into Office 365 without any hassle. Using this software users can multiple OST files into Office 365 with complete data security. It offers users
Add Zoho One Groups/Departments to Shared Mailbox Access
Hi, I hope you're doing well. Currently, in Zoho Mail, I can manually add specific users or the entire organization to a shared mailbox. However, there is no option to add Zoho One groups or departments. Feature Request: We would like the ability to assign
Allow Filters with Only Special Characters in Zoho Mail
Hi Zoho Mail Team, I hope you're doing well. We have noticed that currently, Zoho Mail does not allow creating filter criteria using only special characters, such as = or #. However, there are scenarios where such a filter is necessary. For example: Filtering
How to save email as PDF?
I saw 2 previous threads about this. One is from 14 years ago. The other was closed as "answered" a year ago but the feature was never implemented: https://help.zoho.com/portal/en/community/topic/how-to-download-save-emails-as-pdf Is the "save as PDF"
Flexible plans
Hi, I have a Workplace Standard subscription. On Zoho's website, it mentions that with the annual plan it's possible to have multiple plans under the same organization—for example, Workplace Standard and Mail Lite. However, I can’t find a way to do this
Weekly Tips : Teamwork made easy with Multiple Assignees
Let's say you are working on a big project where different parts of a single task need attention from several people at the same time—like reviewing a proposal that requires input from sales, legal, and finance teams. Instead of sending separate reminders
Cannot give public access to Html Snippet in Zoho Creator Page
Hi, I created a form in Zoho Creator and published it. The permalink works but I want to override the css of the form. (style based URL parameters is not good enough) So I created a page and added an Html snippet. I can now override the css, which is
Weekly Tips : Customize your Compose for a smoother workflow
You are someone who sends a lot of emails, but half the sections in the composer just get in your way — like fields you never use or sections that clutter the space. You find yourself always hunting for the same few formatting tools, and the layout just
Unable to confirm Super Admin assignment — confirmation button not working
I’m trying to change the roles within my organization. I am currently a super admin and would like to add another user as a super admin. When I attempt to confirm the action, a screen appears asking for my password to verify my identity. However, when
Installing EMAIL Setup in New Domain
Respected Support team, I'm facing an issue with cloudflare in Pakistan, I want to setup Zoho Mail Setup but I Don't know how to enable Zoho mail setup without cloudflare. My Website https://stumbleguyzzapk.com/, https://fakservices.com/ is using CF,
Will I Get a Refund If I Downgrade Zoho Mail?
Hello, We upgraded an email account for our new employee. However, the employee left after one month, and now I've reduced the number of Zoho Mail users from 7 to 6. Can we get a refund for the remaining portion of our annual payment?
Accounting on the Go Series-43:Enhancing Your Reporting Efficiency with Dashboard Filter State Retention
Hello everyone! Welcome back to our series on Zoho Books mobile app features. Today, we will talk about a feature that yet again helps you focus on work that really matters-Dashboard Filter State Retention. Imagine you're working on your Zoho Books dashboard,
Zoho books/payroll tax payment
I accidentally made a second payment to my taxes for $300 which is reflected in my bank account and therefore on Zoho books but I can not match it to any transactions because its not reflected in payroll as a tax payment. Is there a way to add an extra
I can't renew the Finance Plus subscription
I tried to renew the Finance Plus subscription but it keeps reloading the same page over and over when ever I click on "Renew Subscription" button
Estimate vs Quote
they are different. Quote is for 1 piece price + other charges. Estimate is for total quantity to be ordered. The gross total amount of the Estimate is the amount payable. Replacing Estimate as Quote is not understandable because they are different. In
Accounting on the Go Series-47: Effortless GSTIN Management- Auto Populate TaxPayer Details in Zoho Books Mobile App
Hello everyone, Welcome back! Today, we're focusing on a feature specifically designed for our Indian users in the Zoho Books-Indian edition, particularly those who deal with GST compliance regularly. We understand the importance of accurate and efficient
Accounting on the Go Series-48: Enhance Accuracy with Custom Work Week Start Days in Zoho Books iOS app
Hello everyone, Welcome back! We’re here with another feature spotlight that might seem small but can have a big impact on your daily routine: setting the first day of the work week in the Zoho Books iOS app. Imagine this: You’re a business owner who
Time to Get Paid Report in ZBooks
Hello, One of our customers who has 25 different companies around the world gets 60 days to make payments. Unfortunately, the subject report does not report an average time to get paid (in days) or the ability to look at a custom period of time. Currently
How to prepare a balance sheet for a company that has no operations yet?
.
Project Billing Method from Zoho People
Normaly our customers use Zoho Projects to manage projects and timesheet that are being charge to the customer. Using the integration from Zoho Project we can have projects base on different billing method. For example most of our customer use Hourly
Zoho Books-Accounting on the Go Series!
Dear users, Continuing in the spirit of our 'Function Fridays' series, where we've been sharing custom function scripts to automate your back office operations, we're thrilled to introduce our latest initiative – the 'Zoho Books-Accounting on the Go Series'.
Zoho Books | Product updates | July 2025
Hello users, We’ve rolled out new features and enhancements in Zoho Books. From plan-based trials to the option to mark PDF templates as inactive, explore the updates designed to enhance your bookkeeping experience. Introducing Plan Based Trials in Zoho
Zoho Books | Product updates | August 2025
Hello users, We’ve rolled out new features and enhancements in Zoho Books. From the right sidebar where you can manage all your widgets, to integrating Zoho Payments feeds in Zoho Books, explore the updates designed to enhance your bookkeeping experience.
Apply Payment Received Amount Zoho Books Invoice
Hello team here is the sample code How can apply the payment received record over a unpaid zoho books invoice. //......................... paymentID = customer_payment.get("payment_id"); organizationID = organization.get("organization_id"); paymentmaplist
Update or Upsert Records Using Unique Custom Fields
Hello customers, We've enhanced the process of updating records via API. You can now: Update records using unique custom fields Upsert records using unique custom fields Note: Both the features are available in the Zoho Books and Zoho Inventory apps.
[Webinar] Understanding the New Invoice Management Systems
Join industry expert CA Pritam Mahure as he discusses the importance of the new Invoice Management System (IMS) and its impact on taxpayers. Topics Covered: - Concept of IMS and pre-requisites - Applicability and Restrictions on Invoices/Records for IMS
Accounting on the Go Series-51: Effortless Transactions: Create and Manage Directly from Uploaded Documents
Hello everyone, We’re back with another useful feature that makes working with Zoho Books even easier! This time, we’re simplifying the process of creating transactions directly from uploaded documents. Imagine you’re out meeting clients, and you receive
Next Page