Skip to Content

AI Fill

Overview

This function automatically fills missing or incomplete data by analyzing patterns from a provided example range. It’s particularly useful for completing datasets where there’s a predictable relationship between columns, helping to automate data entry and ensure consistency.

View Python code on GitHub

Usage

Automatically fills in missing data in a target range by learning patterns from an example range.

=AI_FILL(example_range, fill_range, [temperature], [model], [max_tokens])

Arguments:

ArgumentTypeDescriptionDefault
example_range2D listThe range containing complete data that serves as the basis for detecting patterns and relationships.
fill_range2D listThe range with incomplete data that will be filled based on the detected patterns from the example_range.
temperaturefloatOptional: Controls the randomness/creativity of the response (0.0 to 2.0). Lower values are more deterministic.0.0
modelstringOptional: The specific AI model ID to use (must support JSON mode, e.g., ‘mistral-small-2501’).mistral-small-2501
max_tokensintOptional: Maximum number of tokens for the generated content.1500

Returns:

Return ValueTypeDescription
Filled Data2D listA 2D list with the missing data filled in. Returns [["Error: ..."]] on failure.

Examples

1. Completing Product Catalog Information

Fill in missing product specifications based on similar products.

Example Range (A1:D4):

Product IDCategoryPriceWeight (kg)
PRD-001Laptop12991.8
PRD-002Laptop9992.1
PRD-003Tablet4990.7

Fill Range (A5:D7):

PRD-004Laptop
PRD-005Tablet
PRD-0067991.2
=AI_FILL(A1:D4, A5:D7)

Sample Output:

PRD-004Laptop10991.9
PRD-005Tablet5490.8
PRD-006Laptop7991.2

2. Filling Employee Information

Complete missing employee department and location information based on job titles.

Example Range (A1:D5):

Employee IDJob TitleDepartmentLocation
EMP-001Sales ManagerSalesNew York
EMP-002Marketing SpecialistMarketingChicago
EMP-003Sales RepresentativeSalesLos Angeles
EMP-004Software DeveloperEngineeringSan Francisco

Fill Range (A6:D9):

EMP-005Sales Director
EMP-006UX Designer
EMP-007Marketing Director
EMP-008Senior Developer
=AI_FILL(A1:D5, A6:D9)

Sample Output:

EMP-005Sales DirectorSalesNew York
EMP-006UX DesignerEngineeringSan Francisco
EMP-007Marketing DirectorMarketingChicago
EMP-008Senior DeveloperEngineeringSan Francisco

3. Completing Financial Forecasts

Fill in missing quarterly projections based on existing data and trends.

Example Range (A1:E3):

MetricQ1 2024Q2 2024Q3 2024Q4 2024
Revenue250000280000310000350000
Expenses180000195000215000235000

Fill Range (A4:E6):

Profit
Headcount3235
=AI_FILL(A1:E3, A4:E6)

Sample Output:

Profit700008500095000115000
Headcount32353842
Last updated on