TIGZIG: Co-Analyst - python in excel xlwings lite starting off data transformation summary charts visualizations | TIGZIG Co-Analyst
Try the App Live

This HTML page was converted from the original PDF. Some images and complex layouts may not appear correctly. For the best experience, please download the PDF above.


xlwings Lite: The AI Way

Your Quick Start to Python In Excel

Coding Experience not Required


Delete Sort & Filter Find & Select Add-ins Analyze Data Copilot Create a PDF Excel Lab
Format Add-ins Adobe Acrobat
Cells Editing

F xlwings Lite
CARD_POS CREDIT_Ci
1,45,29,576
xlwings Lite
main.py requirements.txt
21 add_derived_metrics(book: xw.Book):
28 try:
49 for col in numeric_cols:
51 print("🌟 Converted key columns to numeric")
52 # 4. Calculate requested Totals and Averages
54 print("📊 Calculating totals and averages")
8,02,782
2,09,223
43,98,943
9,72,962
2,46,721
16,55,638
12,04,03,585
22,24,987
9,83,66,074
1,958
2,32,061
7,85,943
1,314
623

Module 01

Data Transformations, Visualizations and AI Generated variables

Download Starter Kit

app.tigzig.com


TIGZIG: Co-Analyst OSS xlwings Lite Tools Analyze GPTs MCP


xlwings Lite: Practice Lab

Learn xlwings Lite by practical examples

💡 Quick Start Resources: Download our AI-ready instructions, view guides, and get example workbooks to jumpstart your xlwings Lite journey!


AI Coder Instructions View Instructions

Download these markdown instructions to upload to AI/LLM for automated code generation. Perfect for getting started with AI-powered Excel automation.
View the AI instructions in a human-readable, formatted examples for easy reference.

Example Workbooks & Guides

Description Workbook
Basic Data Manipulation: Creating derived variables, summary tables, and charts

Setup AI

Use Google AI Studio
A powerhouse of AI Tools. Free.

🔗 [aistudio.google.com])(undefined)


[The image shows a partial screenshot of the AI Studio interface with the text "Welcome to AI Studio" and a prompt input box. On the right side, there is a "Run settings" panel with the following details:]

Run settings
Model Gemini 2.5 Pro
Token count 0 / 1,048,576
Temperature [slider set to 1]
Thinking
- Thinking mode Off
- Set thinking budget Off

  1. Upload
    AI_CODER_INSTRUCTIONS.md

  2. Put Starter Prompt from example workbook and hit enter


Prepare Your Data

Best Practice: Setup data as a ‘Table’

Excel Table Sample
CATEGORY DATE BANK_NAME CREDIT_CARDS_N( CREDIT_CARC
Public Sector Banks 31 March 2025 BANK OF BARODA 30,43,116 73
Public Sector Banks 31 March 2025 BANK OF INDIA 72,760
Public Sector Banks 31 March 2025 BANK OF MAHARASHTRA 27,869
Public Sector Banks 31 March 2025 CANARA BANK 9,62,773
Public Sector Banks 31 March 2025 INDIAN BANK 2,83,126
Public Sector Banks 31 March 2025 INDIAN OVERSEAS BANK 72,673
Public Sector Banks 31 March 2025 PUNJAB NATIONAL BANK 6,04,213
Public Sector Banks 31 March 2025 STATE BANK OF INDIA 2,08,23,857
Public Sector Banks 31 March 2025 UNION BANK OF INDIA 4,95,099
Private Sector Banks 31 March 2025 AXIS BANK LTD 1,48,99,543

Sample data in Excel workbook


Install xlwings Lite Add-in

Installation

  1. Click on the Add-ins button in Excel. Usually, it is located on the Home tab, but if you are using an older version of Excel, it could be on the Insert tab.
  2. Search for xlwings
  3. Click on Add to install:
1 Add-ins Analyze Data Copilot
2
More search results
xlwings Lite
xlwings Lite brings the power of Python...
Terms & Conditions

Image from lite.xlwings.com


Asking AI for Data Transformations

Prompt 1

Instruct AI for metrics and calculations you need

Prompt 1: Creating Derived Variables

See attached few sample rows. Data is formatted as table name RBICC. Gimme code to add the following fields:

Keep in mind that the volume is in actuals and value is in Rs. '000. I want the averages as actuals. In addition – I want to do profiling of the banks. So add additional derived variables that could be helpful and insightful – add between 5–10 additional variables based on your judgment.

CATEGORY DATE BANK_NAME CREDIT_CARDS_NOS CREDIT_CARD_POS_TXN_VOLUME_NOS CREDIT_CARD_POS_TXN_VALUE_AMT CREDIT_CARD_ECOM_VOLUME_NOS CREDIT_CARD_ECOM_VALUE_AMT
Public Sector Banks 31 March 2025 BANK OF BARODA 30,43,116 73,31,814 1,45,29,576 33,50,020 1,76,45,596
Public Sector Banks 31 March 2025 BANK OF INDIA 72,760 1,79,338 8,02,782 64,587 3,23,581
Public Sector Banks 31 March 2025 BANK OF MAHARASHTRA 27,869 43,827 2,09,223 19,575 1,10,022
Public Sector Banks 31 March 2025 CANARA BANK 9,62,773 10,84,539 43,98,943 4,91,612 29,71,536

All Prompts in Example Workbook


Run the AI Generated Code

AI will give you a code – paste that into main.py and run it (it will show up the name of function created)


Python Script for xlwings Lite

Generated python

import pandas as pd
import numpy as np
import xlwings as xw
from xlwings import script

import matplotlib.pyplot as plt
import seaborn as sns
import os
import tempfile
from matplotlib.ticker import FuncFormatter

# --- Mandatory Helper Function (as per guidelines) ---
def find_table_in_workbook(book: xw.Book, table_name: str):
    """Searches all sheets for a table with the given name"""
    for sheet in book.sheets:
        if table_name in sheet.tables:
            return sheet.tables[table_name]
    return None

Screenshot content transcription (Excel and xlwings Lite add-in UI):

ARD_ECC xlwings Lite
33,50,020
64,587 xlwings Lite
19,575
4,91,612 create_visualizations
3,02,073
27,544
3,12,515 main.py
5,32,87,190 requirements.txt
15,81,624 import pandas
2,80,95,443 import numpy as np
518 import xlwings
22,657 from xlwings import script
17,02,024 import matplotlib.pyplot as plt
184 import seaborn as sns
7,682 import tempfile
17,88,789 from matplotlib.ticker import FuncFormatter
3,70,20,937
6,50,86,576
59,430
25,47,385
93,44,211
1,04,753
8,744
44,93,272 Python 3.12.7 Pyodide 0.27.5 xlwings 0.33.14
56,56,315

Excel ribbon and xlwings Lite add-in toolbar (textual representation):


Note: The numbers in the table appear to be data values or counts but their exact meaning is not explicitly stated in the screenshot.


Validate Outputs

The calculations we specifically requested

CREDIT_CARD_ECOM_VALUE_AMT TOTAL_CC_TXN_VOLUME_NOS TOTAL_CC_TXN_VALUE_AMT_000 AVG_TXN_VOLUME_PER
20 1,76,45,596 1,06,81,834 3,21,75,172
87 3,23,581 2,43,925 11,26,363
75 1,10,022 63,402 3,19,245
12 29,71,536 15,76,151 73,70,479
73 13,71,482 5,13,202 23,44,445

8 Extra variables from AI based on its judgment

AVG_POS_TICKET_SIZE_ACTUAL AVG_ECOM_TICKET_SIZE_ACTUAL AVG_OVERALL_TICKET_SIZE_ACTUAL POS_VOLUME_SHARE_PCT
1,982 5,267 3,012 69
4,476 5,010 4,618 74
4,774 5,621 5,035 69
4,056 6,044 4,676 69
4,608 4,540 4,568 41
3,285 4,218 3,535 73

Tip: For AI-derived variables, you can push the boundaries by increasing the variable count, or focus on a particular type of metric—e.g., % compositions, market share, etc.


What if you get an error?


xlwings Lite

import pandas as pd
import numpy as np
import xlwings as xw
from xlwings import script
import matplotlib.pyplot as plt
import seaborn as sns
import os
import tempfile
from matplotlib.ticker import FuncFormatter

# --- Mandatory Helper Function (as per guidelines) ---
def find_table_in_workbook(book: xw.Book, table_name: str):
    """Searches all sheets for a table with the given name"""
    for sheet in book.sheets:
        if table_name in sheet.tables:
            return sheet.tables[table_name]
    return None
File "/lib/python3.12/site-packages/xlwings/pro/udfs_officej":
    await func(*args, **kwargs)
File "/home/pyodide/main_editor.py", line 148, in create_visu
    raise e
File "/home/pyodide/main_editor.py", line 65, in create_visu
    raise Exception("FATAL: Table 'RBICC' not found.")
Exception: FATAL: Table 'RBICC' not found.

Copy the error, paste it into the AI, and ask it to fix it.
AI will share back the revised code or let you know if something required from your end.


Creating Profile Summary

Prompt 2

Describe one or more summarizations – across any level and the KPI’s required


Prompt 2 : Creating Profile Summary

Now give me a nicely formatted summary showing all the profiling variables grouped by category. Use the profiling variables I had asked for, plus the ones you had created.
Put that in a new sheet called RBI_SUMM. Delete any existing sheet if it exists.

But keep in mind - you can’t just do the average of the average by using the earlier derived variables. You’d need to recompute them at the grouped level.



All Prompts in Example Workbook


Profile Summary

Profile Summary output in a new sheet titled
RBI_SUMM

Credit Card Profiling Summary by Category
Category Avg Transactions per Card Avg Spend per Card (Rs) Avg Ticket Size (Rs) Avg POS
Foreign Banks 2.7 21,984.2 8,008.0
Private Sector Banks 4.5 19,624.3 4,407.8
Public Sector Banks 3.6 14,291.9 3,934.8
Small Finance Banks 2.8 9,066.9 3,257.8

Tip: Ask AI to create as many cuts as you need and have it place the tables one below the others.

All Prompts in Example Workbook


Creating Charts

Prompt 3

Prompt 3 : Creating Charts

Gimme the following charts, all nicely formatted and all. Paste them one below the other into a new sheet called charts.

  1. Correlation matrix for all the numeric variables (take only the original variables)
  2. Bar chart of top 10 banks by average credit card value
  3. Combo bar chart – 2 axis – from the profiling table you created for average volume and value per card
  4. Box plots for all the original numeric variables

Tip: Get the basic charts out, and then go for formatting – label fonts, title placement, axis etc

Tip: To get multi-panel chart ask AI to e.g. keep the bar chart as the main chart and add the line chart as a subplot

All Prompts in Example Workbook


Refine Charts

Visual Analysis Report
Correlation Matrix of Original Numeric Variables
CREDIT_CARDS_NOS CREDIT_CARD_POS_TXN_VOLUME_NOS CREDIT_CARD_POS_TXN_VALUE_AMT CREDIT_CARD_ECOM_VOLUME_NOS CREDIT_CARD_ECOM_VALUE_AMT
CREDIT_CARDS_NOS 1.00 0.88 0.99 0.93 0.96
CREDIT_CARD_POS_TXN_VOLUME_NOS 0.88 1.00 0.94 0.68 0.91
CREDIT_CARD_POS_TXN_VALUE_AMT 0.99 0.94 1.00 0.88 0.98
CREDIT_CARD_ECOM_VOLUME_NOS 0.93 0.68 0.88 1.00 0.89
CREDIT_CARD_ECOM_VALUE_AMT 0.96 0.91 0.98 0.89 1.00
Avg Transactions vs. Avg Spend per Card by Category
Avg Transactions Avg Spend
Bar chart (approximate values) Line chart (approximate values)

⚠️ It did not place the charts one below the others. Share the image and ask it to fix it.

Tip: Get the basic chart out and share instruction to refine the visuals. E.g

All Prompts in Example Workbook


Validate Always

Validations are sacrosanct – AI or no AI

AI’s make mistakes – from formulas to logic.
Far less than humans – but it happens
Always validate output

# 4. Calculate requested Totals and Averages
print("🧮 Calculating totals and averages...")

# --- Totals ---
df['TOTAL_CC_TXN_VOLUME_NOS'] = df['CREDIT_CARD_POS_TXN_VOLUME_NOS'] + df['CREDIT_CARD_ECOM_VOLUME_NOS']

# Value is in '000s, so we calculate total in '000s first
df['TOTAL_CC_TXN_VALUE_AMT_000'] = df['CREDIT_CARD_POS_TXN_VALUE_AMT'] + df['CREDIT_CARD_ECOM_VALUE_AMT']

# --- Averages (in actuals) ---
# Convert total value to actuals for average calculation
total_value_actual = df['TOTAL_CC_TXN_VALUE_AMT_000'] * 1000

df['AVG_TXN_VOLUME_PER_CARD'] = df['TOTAL_CC_TXN_VOLUME_NOS'] / df['CREDIT_CARDS_NOS']
df['AVG_TXN_VALUE_PER_CARD_ACTUAL'] = total_value_actual / df['CREDIT_CARDS_NOS']

Best Practice: Review the core parts of the code e.g. formulas – they will look just like Excel formulas and intuitive to understand

Tip: For complex logic and formulas, ask AI to walk you through it step by step


Working with AI

Top 4 Tips


Power User Tip

Dictate Your Prompts

Typing long, detailed instructions is slow. Use your operating system's built-in dictation to work faster.

Windows ![Windows logo] and Apple ![Apple logo]

On Windows: Press Win + H to start Voice Typing.

On macOS: Press the Microphone key (F5) or press the Fn key twice.


Ask AI to be Your Guide

Don’t hesitate to ask the simple questions. The AI's only job is to help

"What are these df and def things in the code?"

"I don’t get it. Can you explain in a different way"

It will not judge you
It will be patient
It will not give up till you get it


TIGZIG Co-Analyst

Get the Starter Kit
and All Future Modules
Free

app.tigzig.com

![Open Source]

Amar Harolikar
Specialist – Decision Sciences & Applied Gen AI
Building Practical AI Tools for Analytics & Data Science