Find the insights and best practices about our product.
🤖 Trackline – Proactive automation
🔎 SmartCheck – Digital evidence
🚀 Use cases by sector
Food sector
Construction sector
Industrial sector
Logistics sector
👤 Role based use cases
📊 Use cases by functionality
🤝🏻 Partners
SmartCheck Integration with Excel

SmartCheck Integration with Excel

Certify your Excel content directly from the server
SmartCheck is a feature of Code Contract that allows you to generate unique, secure, and tamper-proof digital evidence in just seconds, at an accessible cost.

One of the most common applications is the certification of Excel content. Below, we detail how to carry out this process:

Step 1: Obtain the Authentication Token

To use the SmartCheck API, you must first authenticate via a POST request to obtain a JWT token.

Authentication Request (HTTP Request)

POST /login HTTP/1.1  
Host: api.codecontract.io
Content-Type: application/json

{
"email": "[email protected]",
"password": "your_password"
}

Expected Response

HTTP/1.1 200 OK  
Content-Type: application/json

{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
}

Important:
✔️ The returned token must be stored and sent in every subsequent request as a Bearer Token in the Authorization header.
✔️ If Microsoft Excel uses OAuth for authentication, you must first obtain an OAuth token and send it to SmartCheck.

Step 2: Read Excel Data and Certify with SmartCheck

You can use the Microsoft Graph API or Python with Pandas to extract data from an Excel spreadsheet and send it to SmartCheck.

Example: Extract Excel data and certify it on the blockchain

Here’s how to read data from an Excel file and certify it via SmartCheck:

1️⃣ Get Excel data using Python

import pandas as pd

def get_excel_data(file_path, sheet_name):
""" Reads data from an Excel file """
df = pd.read_excel(file_path, sheet_name=sheet_name)
return df.values.tolist()

# Replace with your Excel file and specific sheet name
EXCEL_FILE = "data.xlsx"
SHEET_NAME = "Sheet1"

excel_data = get_excel_data(EXCEL_FILE, SHEET_NAME)
print("Data retrieved from Excel:", excel_data)

2️⃣ Send the Excel data to SmartCheck

import requests

def certify_excel_data(data):
""" Sends Excel data to SmartCheck for certification """
url = "https://api.codecontract.io/smartcheck/createTreeAndRegisterMerkleRoot"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
}
payload = {
"data": data
}

response = requests.post(url, json=payload, headers=headers)
return response.json()

# Certify the retrieved Excel data
certification_response = certify_excel_data(excel_data)

print("Certification response:", certification_response)

Expected Response

{
"merkleRoot": "abc123...",
"transactionId": "tx123...",
"status": "success"
}

What does this mean?

✔️ merkleRoot: Merkle root generated from the certified data.
✔️ transactionId: ID of the transaction recorded on the blockchain.
✔️ status: Indicates whether the certification was successful.

Step 3: Verify Certified Data from Excel

If you need to verify that the data has been certified, you can query the proof in SmartCheck.

Request to Retrieve Certification Details

GET /smartcheck/reportsProofDetail?reportId=your_report_id HTTP/1.1  
Host: api.codecontract.io
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...

Expected Response

{
"reportId": "your_report_id",
"merkleRoot": "abc123...",
"data": [
["ID", "Name", "Amount", "Date"],
["1", "Juan Pérez", "500", "2024-02-10"],
["2", "María López", "750", "2024-02-11"]
],
"status": "verified"
}

Summary

✔️ Step 1: Obtain the JWT token by authenticating with your Microsoft account.
✔️ Step 2: Use Python with Pandas or Microsoft Graph API to retrieve data from Excel.
✔️ Step 3: Send the data to SmartCheck for blockchain certification.
✔️ Step 4: Verify the certification when needed.

If you need further information or support, please contact the Code Contract team. 🚀