The Discovery of That Afternoon
One afternoon, a team member asked a question. 「If we input a tracking number, can the shipping status be automatically populated?」 That's when it all began.
Until now, we manually entered shipping statuses or switched between multiple tabs. But with a simple automation using Claude Code, everything changed completely. Automatically read shipping data, determine status, and record it in Google Sheets.
Four Steps to Build Shipment Tracking Automation
Step 1: Prepare Your Google Sheet
First, create columns to receive tracking numbers and display status.
Column A: Order Number
Column B: Shipment Tracking Number (awaiting input)
Column C: Shipping Status (auto-update expected)
Column D: Last Updated Time
Step 2: Design Functions in Claude Code
Write the following logic in your Claude Code script.
def get_shipping_status(tracking_number):
"""Query status from shipment tracking number"""
# Collect data via actual carrier API or web scraping
# Example: "In Transit", "Delivered", "Not Yet Shipped", etc.
return status
def update_sheet_with_status(sheet_id, row, status, timestamp):
"""Record status to the Google Sheet row"""
# Use Google Sheets API
pass
Step 3: Set Up Triggers
Connect your Google Sheet to Claude Code so it automatically executes when a tracking number is entered.
Tip: Use Apps Script's onEdit trigger to execute the function the moment data is entered in Column B.
function onEdit(e) {
var range = e.range;
if (range.getColumn() == 2) { // Column B
var trackingNumber = range.getValue();
// Call Claude Code API
callClaudeCodeAPI(trackingNumber);
}
}
Step 4: Test and Fine-Tune
On your Windows device, input a few tracking numbers to verify accuracy. Check if shipping status updates correctly and time formats are proper.
Unexpected Bonuses
Operating this system revealed several unforeseen benefits.
• **Pattern Discovery**: As shipping status data accumulates, it automatically shows which carrier is faster.
• **Exception Detection**: If the "In Transit" status lasts more than 3 days, automatic alerts can be sent.
• **Multilingual Support**: Different language status codes from various carriers can be automatically standardized.
Conclusion
The core of this automation is "one input, multiple values." A single tracking number enables status lookup, logging, and analysis simultaneously. Non-developers only need to understand Claude Code's simple API connection structure to build far more complex automations.
Next week, we plan to build a carrier performance assessment system based on this accumulated data.