AI for automating partnership agreements (APA)Record inserted or updated successfully.
AI & Accounting

AI for automating partnership agreements (APA)

Author :CA. Chinmayy Pathak

Watch on Youtube

Introduction:

CA Chinmay Pathak is a practising Chartered Accountant and a visiting faculty at various prestigious institutions specializing in Soft Skills Development and Artificial Intelligence. With experience in conducting sessions at various Central and State Universities across India, he is dedicated to making complex legal and financial concepts accessible.

Problem Statement:

Drafting partnership agreements is a time-consuming and error-prone process. Traditional methods involve manual data entry, leading to inconsistencies, inefficiencies, and potential legal errors. Startups and SMEs, in particular, face challenges in ensuring compliance while managing the administrative burden of agreement drafting.

Currently, our process involves multiple steps:

  1. Data Collection – We gather details from the client.
  2. Initial Drafting – Our staff manually edits an old agreement template, replacing dynamic fields.
  3. Internal Review – The draft is sent to us for review and corrections.
  4. Client Feedback – The revised draft is shared with the client for suggestions.
  5. Revisions – The staff incorporates client feedback and resends the document.
  6. Final Approval – The client confirms the final version.
  7. Printing & Execution – The agreement is finalized and printed.

This iterative process leads to delays, additional costs, and inefficiencies.


Solution Overview: 

Step 1: Create a Google Form

  1. Open Google Forms (forms.google.com).
  2. Click on Blank Form and give it a title like "Partnership Agreement Form".
  3. Add relevant fields for partner details, business details, profit sharing, etc. Example fields:
  4. Partner 1 Name (Short Answer)
  5. Partner 1 PAN (Short Answer)
  6. Partner 1 Age (Short Answer)
  7. Partner 1 Occupation (Short Answer)
  8. Partner 1 Address (Paragraph)
  9. Partner 2 Name (Short Answer)
  10. Business Name (Short Answer)
  11. Nature of Business (Short Answer)
  12. Initial Capital Contribution (Short Answer)
  13. Profit Sharing Ratio (Short Answer)
  14. Click on the Responses tab → Click on Link to Sheets to connect it to a Google Sheet.

Step 2: Link Google Form to Google Sheet

  1. A new Google Sheet will be created, capturing form responses.
  2. Rename the sheet to something meaningful like "Partnership Deed Responses".
  3. Keep this Google Sheet open, as we will use it in the script.

Step 3: Add Google Apps Script for Automation

  1. In your Google Sheet, go to Extensions → Apps Script.
  2. Delete any existing code and paste the following script:

function generatePartnershipDeed() {

 try {

  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();

  var lastRow = sheet.getLastRow();

  var data = sheet.getRange(lastRow, 1, 1, sheet.getLastColumn()).getValues()[0];


  var templateId = "YOUR_TEMPLATE_ID"; // Replace with your Google Docs Template ID

  Logger.log("Using Template ID: " + templateId);


  var templateFile = DriveApp.getFileById(templateId);

  if (!templateFile) throw new Error("Template file not found or inaccessible.");


  // Ensure the document is created

  var doc = templateFile.makeCopy("Partnership Deed - " + data[1]); // Partner1 Name

  if (!doc) throw new Error("Failed to create a copy of the template.");

  

  var docId = doc.getId();

  var docFile = DocumentApp.openById(docId);

  var body = docFile.getBody();


  Logger.log("Generated document ID: " + docId);


  var placeholders = {

   "{{Partner1_Name}}": data[1] || "________",

   "{{Partner1_PAN}}": data[2] || "________",

   "{{Partner1_Age}}": data[3] || "________",

   "{{Partner1_Occupation}}": data[4] || "________",

   "{{Partner1_Address}}": data[5] || "________",

   "{{Partner2_Name}}": data[6] || "________",

   "{{Partner2_PAN}}": data[7] || "________",

   "{{Partner2_Age}}": data[8] || "________",

   "{{Partner2_Occupation}}": data[9] || "________",

   "{{Partner2_Address}}": data[10] || "________",

   "{{Business_Name}}": data[11] || "________",

   "{{Business_Address}}": data[12] || "________",

   "{{Nature_of_Business}}": data[13] || "________",

   "{{Initial_Capital}}": data[14] || "________",

   "{{Profit_Sharing}}": data[15] || "________",

   "{{Bank_Name}}": data[16] || "________",

   "{{Authorized_Partners}}": data[17] || "________",

   "{{Interest_Rate}}": data[18] || "________",

   "{{Notice_Period}}": data[19] || "________",

   "{{Special_Clauses}}": (data.length > 20) ? data[20] : "________"

  };


  for (var key in placeholders) {

   body.replaceText(key, placeholders[key]);

  }


  docFile.saveAndClose();


  var docUrl = doc.getUrl();

  Logger.log("Generated Document URL: " + docUrl);


  sheet.getRange(lastRow, sheet.getLastColumn() + 1).setValue(docUrl);

  

 } catch (error) {

  Logger.log("Error: " + error.message);

 }

}


Step 4: Configure the Script & Triggers

  1. Replace "YOUR_TEMPLATE_ID" with the Google Docs template ID of your partnership agreement format.
  2. Open your Google Docs template
  3. Copy the ID from the URL (it looks like this: 1zYJDt-dyIPMKPBApQXjQTdAAiB-Zc1beZujMtvwi5vM)
  4. Replace "YOUR_TEMPLATE_ID" in the script with this ID.
  5. Click on the Clock Icon (Triggers) → Add Trigger
  6. Choose function to run: generatePartnershipDeed
  7. Select event source: From form
  8. Select event type: On form submit
  9. Click Save.

Step 5: Share the Google Form with Clients

  1. Copy the Google Form link from the form editor.
  2. Share it with clients who need a partnership agreement.
  3. Once they fill out the form, the script will automatically generate a customized agreement in Google Docs.

Final Output

✅ A Partnership Agreement is automatically created with the client’s details.

✅ The Google Sheet stores the document link for reference.

✅ The client receives the finalized deed without any manual work.


Conclusion:

Automating Partnership Agreements (APA) system streamlines the traditional time-consuming and error-prone process of drafting partnership deeds. By integrating Google Forms, Sheets, Docs, and Apps Script, it enables one-click automation, reducing manual effort while ensuring accuracy, consistency, and efficiency. This solution saves time, cost, and resources, making it an ideal choice for legal professionals and businesses.