Spreadsheet Formula to Pandas Converter

Translate supported spreadsheet formula patterns into reviewable pandas code with editable column mappings.

On-device No sign-up Free to use

Translate formula controls

Showing an example. Edit to see your own.

Processed in your browser. Your inputs stay on this device.

Result

Showing an example.

Map the spreadsheet range A2:A4 to the first three rows of an amount column.

result = pd.to_numeric(df["amount"], errors="raise").iloc[0:3].sum(skipna=True, min_count=0)
The template maps A2:A4 to the first three rows of df["amount"]. No spreadsheet or Python code is executed here.

Loading the tool. Your result will appear here.

https://usefreetools.net/spreadsheet-formula-to-pandas · 20 November 2026

Was this helpful?

How to use Spreadsheet Formula to Pandas Converter

  1. Enter one scalar formula using supported functions or arithmetic. Sheet names, text literals, defined names and dynamic references are not accepted.
  2. Map spreadsheet column letters to DataFrame column names in the JSON field or mapping controls. Set which spreadsheet row corresponds to DataFrame row 0.
  3. Generate the template and check the reference table. For example, with first row 2, A2:A4 maps to positions 0 through 2.
  4. Review numeric conversion, missing values and rounding before running formula-template.py in your own Python environment. The page does not execute Python or calculate the workbook.

Example: Spreadsheet Formula to Pandas Converter

Map the spreadsheet range A2:A4 to the first three rows of an amount column.

You add
Spreadsheet formula: =SUM(A2:A4); Column mapping (JSON): {"A":"amount"}; Spreadsheet row for DataFrame row 0: 2
You get
result = pd.to_numeric(df["amount"], errors="raise").iloc[0:3].sum(skipna=True, min_count=0) The template maps A2:A4 to the first three rows of df["amount"]. No spreadsheet or Python code is executed here.

Supported inputs and limits

  • Supports SUM, AVERAGE, MIN, MAX, ABS, ROUND and IF, plus the implemented numeric arithmetic and comparisons.
  • Ranges must run forward within one mapped column; map one to 100 columns.
  • References must fall within 10,000 rows of the configured first row.
  • Formulas are limited to 4,096 characters, 512 tokens and 32 nesting levels.
  • Sheet names, text literals, defined names, external or dynamic references and other functions are refused.
More details

Generated Python is reviewable text, not executed output.

Where your input is processed

This tool does not upload your inputs. See the limits for anything saved on your device.

Spreadsheet rows and DataFrame positions are different

The first-row setting maps spreadsheet row numbers to zero-based iloc positions. With first row 2, A2 is position 0 and A2:A4 becomes iloc[0:3], whose stop position is excluded. Absolute $ references remain fixed cells; the translator does not simulate filling or copying a formula.

Check numeric, blank and rounding behavior

Mapped values are converted to numbers with errors raised for nonnumeric text and Excel error strings. Aggregates skip missing values: an all-blank SUM becomes 0, while other aggregates can produce NaN. Direct arithmetic with a missing value does not reproduce Excel blank-as-zero behavior. ROUND uses decimal half-up rounding for literal digits from -12 to 12, but binary arithmetic and pandas data types can still differ from Excel. Test representative rows before replacing an existing calculation.

Questions about Spreadsheet Formula to Pandas Converter

Is the generated code executed here?

No. You receive code to inspect and run elsewhere.

Can every Excel function be translated?

No. Unsupported functions and reference forms are refused.

Can missing values behave differently?

Yes. Review the explicit numeric and missing-value assumptions in the generated code.

Page updated · Project managed by Tony Hines · Report a problem with Spreadsheet Formula to Pandas Converter