Documentation

Get started with AI Excel Services in minutes. This guide will walk you through setup and your first API call.

New to APIs? Don't worry! We've made this as simple as possible. Just follow the steps below.

Quick Start Guide

Step 1: Get Your API Key

  1. Sign up for a free account at dashboard
  2. Navigate to your dashboard
  3. Copy your API key (starts with sk_)

Step 2: Test Your API Key

Try this in your browser (replace YOUR_API_KEY):

https://your-domain.com/api/enrich-company.php?company=Microsoft&api_key=YOUR_API_KEY

Step 3: Integrate with Excel

Choose your preferred method:

  • VBA Functions - Easiest, copy/paste our code
  • Power Query - Most powerful for batch operations
  • WEBSERVICE() - Simplest, built into Excel

Authentication

All API requests require authentication using your API key.

Methods

Include your API key in one of two ways:

1. Query Parameter (Recommended)

GET /api/enrich-company.php?company=Acme&api_key=YOUR_KEY

2. HTTP Header

GET /api/enrich-company.php?company=Acme
X-API-Key: YOUR_KEY
Keep your API key secret! Never share it publicly or commit it to version control.

Rate Limits & Credits

Rate Limits

Plan Requests/Hour Requests/Day
Free 100 1,000
Pro 500 10,000
Enterprise Unlimited Unlimited

Credit Costs

Service Credits Notes
Company Enrichment 1 Per successful enrichment
Email Finder 1 0.1 if not found
Text Analysis 0.1-0.5 Based on text length
Cached Results 0 Free!

VBA Integration

The easiest way to use AI Excel Services in Excel.

Setup Instructions

  1. Open Excel and press Alt + F11 to open VBA Editor
  2. Click InsertModule
  3. Copy and paste the code below
  4. Update the API_KEY constant with your key
  5. Save and close VBA Editor

VBA Code

' AI Excel Services VBA Module
Const API_BASE_URL As String = "https://your-domain.com/api/"
Const API_KEY As String = "your_api_key_here"

' Company Enrichment
Function AICompanyIndustry(companyName As String) As String
    Dim url As String
    url = API_BASE_URL & "enrich-company.php?api_key=" & API_KEY
    url = url & "&company=" & WorksheetFunction.EncodeURL(companyName)
    
    Dim json As String
    json = MakeAPICall(url)
    AICompanyIndustry = ParseJSON(json, "industry")
End Function

Function AICompanyEmployees(companyName As String) As String
    Dim url As String
    url = API_BASE_URL & "enrich-company.php?api_key=" & API_KEY
    url = url & "&company=" & WorksheetFunction.EncodeURL(companyName)
    
    Dim json As String
    json = MakeAPICall(url)
    AICompanyEmployees = ParseJSON(json, "employee_count")
End Function

' Email Finder
Function AIFindEmail(personName As String, companyName As String) As String
    Dim url As String
    url = API_BASE_URL & "find-email.php?api_key=" & API_KEY
    url = url & "&name=" & WorksheetFunction.EncodeURL(personName)
    url = url & "&company=" & WorksheetFunction.EncodeURL(companyName)
    
    Dim json As String
    json = MakeAPICall(url)
    AIFindEmail = ParseJSON(json, "email")
End Function

' Sentiment Analysis
Function AISentiment(text As String) As String
    Dim url As String
    url = API_BASE_URL & "analyze-text.php?api_key=" & API_KEY
    url = url & "&text=" & WorksheetFunction.EncodeURL(text)
    url = url & "&analysis_type=sentiment"
    
    Dim json As String
    json = MakeAPICall(url)
    AISentiment = ParseJSON(json, "sentiment")
End Function

' Helper Functions
Private Function MakeAPICall(url As String) As String
    Dim http As Object
    Set http = CreateObject("MSXML2.XMLHTTP")
    
    http.Open "GET", url, False
    http.send
    
    If http.Status = 200 Then
        MakeAPICall = http.responseText
    Else
        MakeAPICall = "ERROR: " & http.Status
    End If
End Function

Private Function ParseJSON(json As String, key As String) As String
    ' Simple JSON parser - extracts value for a key
    Dim searchStr As String
    searchStr = """" & key & """:"
    
    Dim startPos As Long
    startPos = InStr(json, searchStr)
    
    If startPos = 0 Then
        ParseJSON = ""
        Exit Function
    End If
    
    startPos = startPos + Len(searchStr)
    
    ' Skip whitespace and quotes
    Do While Mid(json, startPos, 1) = " " Or Mid(json, startPos, 1) = """"
        startPos = startPos + 1
    Loop
    
    Dim endPos As Long
    endPos = InStr(startPos, json, """")
    If endPos = 0 Then endPos = InStr(startPos, json, ",")
    If endPos = 0 Then endPos = InStr(startPos, json, "}")
    
    If endPos > startPos Then
        ParseJSON = Mid(json, startPos, endPos - startPos)
    Else
        ParseJSON = ""
    End If
End Function

Usage Examples

=AICompanyIndustry("Microsoft")
=AICompanyEmployees("Apple")
=AIFindEmail("Tim Cook", "Apple")
=AISentiment(A2)

Power Query Integration

Best for batch processing multiple companies or contacts.

Batch Company Enrichment

let
    ApiKey = "your_api_key_here",
    ApiBaseUrl = "https://your-domain.com/api/",
    
    // Get source table
    Source = Excel.CurrentWorkbook(){[Name="Companies"]}[Content],
    
    // Function to enrich
    EnrichCompany = (companyName as text) =>
        let
            Url = ApiBaseUrl & "enrich-company.php?api_key=" & ApiKey 
                  & "&company=" & Uri.EscapeDataString(companyName),
            Response = Json.Document(Web.Contents(Url)),
            Data = Response[data]
        in
            Data,
    
    // Add enrichment
    AddedEnrichment = Table.AddColumn(Source, "Data", 
                       each EnrichCompany([Company])),
    
    // Expand data
    ExpandedData = Table.ExpandRecordColumn(AddedEnrichment, "Data",
        {"industry", "employee_count", "headquarters"},
        {"Industry", "Employees", "Location"})
in
    ExpandedData

WEBSERVICE() Function

Simplest method using Excel's built-in function.

Basic Usage

=WEBSERVICE("https://your-domain.com/api/enrich-company.php?company=Microsoft&api_key=YOUR_KEY")

Extract Specific Values

Use FILTERXML to parse JSON response:

=FILTERXML(WEBSERVICE("..."), "//industry")
Note: WEBSERVICE() has limitations. For production use, we recommend VBA or Power Query.

API Reference: Company Enrichment

GET /api/enrich-company.php

Parameters

Parameter Type Required Description
company string Yes* Company name to enrich
domain string No Company domain (improves accuracy)
api_key string Yes Your API key

* Either company or domain required

Response

{
  "success": true,
  "data": {
    "company_name": "Microsoft",
    "domain": "microsoft.com",
    "industry": "Technology",
    "employee_count": "200,000+",
    "revenue_estimate": "$211 billion",
    "founded_year": 1975,
    "headquarters": "Redmond, Washington",
    "description": "Leading technology company...",
    "linkedin_url": "https://linkedin.com/company/microsoft",
    "twitter_url": "https://twitter.com/microsoft",
    "confidence_score": 0.9
  },
  "cached": false,
  "credits_used": 1,
  "credits_remaining": 99
}

API Reference: Email Finder

GET /api/find-email.php

Parameters

Parameter Type Required Description
name string Yes Person's full name
company string Yes* Company name
domain string No Company domain
api_key string Yes Your API key

Response

{
  "success": true,
  "data": {
    "name": "John Smith",
    "email": "john.smith@acme.com",
    "verified": true,
    "confidence": 0.85,
    "title": "Software Engineer",
    "linkedin_url": "https://linkedin.com/in/johnsmith",
    "company": "Acme Corp",
    "domain": "acme.com"
  },
  "credits_used": 1
}

API Reference: Text Analysis

GET POST /api/analyze-text.php

Parameters

Parameter Type Required Description
text string Yes Text to analyze (max 10,000 chars)
analysis_type string Yes sentiment | categorize | extract | summarize
categories string No Comma-separated categories (for categorize)
extract_type string No email,phone,url,date (for extract)
api_key string Yes Your API key

Response (Sentiment)

{
  "success": true,
  "data": {
    "sentiment": "positive",
    "confidence": 0.95,
    "explanation": "Strong positive language detected"
  },
  "credits_used": 0.1
}

Code Examples

cURL

curl "https://your-domain.com/api/enrich-company.php?company=Microsoft&api_key=YOUR_KEY"

Python

import requests

url = "https://your-domain.com/api/enrich-company.php"
params = {
    "company": "Microsoft",
    "api_key": "YOUR_KEY"
}

response = requests.get(url, params=params)
data = response.json()
print(data)

JavaScript

const url = 'https://your-domain.com/api/enrich-company.php';
const params = new URLSearchParams({
    company: 'Microsoft',
    api_key: 'YOUR_KEY'
});

fetch(`${url}?${params}`)
    .then(response => response.json())
    .then(data => console.log(data));

Troubleshooting

Common Errors

401 - Invalid API Key

Cause: API key is missing, incorrect, or expired.

Solution: Verify your API key in the dashboard and ensure it's properly included in requests.

402 - Insufficient Credits

Cause: Your account has run out of credits.

Solution: Add more credits or upgrade your plan.

429 - Rate Limit Exceeded

Cause: Too many requests in a short time.

Solution: Wait a few minutes or upgrade to a higher tier.

CORS Errors

Cause: Browser blocking cross-origin requests.

Solution: Use the proxy.php script provided in the website package.

Support

📧 Email Support

Get help via email

support@aiexcelservices.com

💬 Community

Join our community forum

Visit Forum

📚 Tutorials

Video guides and tutorials

Watch Tutorials
Enterprise customers: You have access to priority support and a dedicated account manager.