Excel Formula to Python and JavaScript Converter
Move spreadsheet logic into an app or script without guessing: name the cells, get working code, and prove it matches Excel.
Körs i din webbläsare. Dina filer lämnar aldrig din enhet. Se hur du kontrollerar det
…
Så gör du
- 1Choose a mode
Press One formula, or Whole sheet from a workbook and open an XLSX file.
- 2Enter the logic
Paste a formula or pick an example; in workbook mode choose the sheet.
- 3Name things
Type variable names for cells and ranges, or press Name variables from labels.
- 4Check the result
Enter test values and compare the live result, or press Test against saved values.
- 5Pick the language
Switch between Python 3 and JavaScript and read the plain English explanation.
- 6Take the code
Press Copy code or Download, or Download module for a whole sheet.
Om det här verktyget
Business rules often live in spreadsheets for years before someone needs them in a web app, a data pipeline or a Python notebook. Rewriting nested IF, VLOOKUP and SUMIFS formulas by hand is error-prone, and Excel's quirks make it worse: ROUND rounds halves away from zero, text comparisons ignore case, and COUNTIF criteria are little expressions of their own. This converter parses a formula with Excel's operator precedence and writes the equivalent Python 3 or JavaScript, using the names you give to cells and ranges so the code reads like the business rule rather than like grid coordinates. Helper functions that reproduce Excel's behaviour are added only when the formula needs them. For a whole workbook, it orders every formula on a sheet by dependency, turns the sheet into one function with inputs and results, and runs the generated JavaScript against the values Excel saved to show which cells match.
Single formula mode
Type or paste a formula, or start from an example such as a discount rule, an exact-match lookup with a fallback, a conditional sum, a loan payment or a grade band. Each referenced cell and range appears in a table where you give it a name and a test value; ranges take a small JSON grid. The result of the generated code updates as you type, and a plain English sentence explains the logic, for example if price is at least 100 then price times one minus the discount rate rounded to 2 places, otherwise price.
Workbook mode
Open an XLSX file and choose a sheet. Shared formulas are expanded cell by cell, references to other sheets become inputs, and the formulas are sorted so every value is computed after the cells it uses. Name variables from labels uses the text in the cell to the left of each value, or the column header, as its variable name. The generated module has one function with the inputs as parameters and their current values as defaults, and it returns every result by cell address. Test against saved values runs each formula through the generated code and lists matches, differences and skipped cells.
Supported functions
About 90 functions translate, covering arithmetic and rounding, logic including IFS, SWITCH and IFERROR, conditional sums and counts with several criteria, lookups with VLOOKUP, HLOOKUP, XLOOKUP, INDEX and MATCH, text functions, information functions, loan functions PMT, FV, PV and NPV, and date serial functions such as DATE, EDATE and EOMONTH. The full list is under the converter.
Limits
Dynamic arrays, LAMBDA, LET, OFFSET, INDIRECT, volatile functions such as TODAY and RAND, and array formulas entered with Ctrl+Shift+Enter are not translated; unsupported names are kept as calls and listed so you can supply your own. Dates are Excel serial numbers in the generated code, not date objects. The tests compare with the last values Excel saved, so a file saved with manual calculation may show differences that are not errors.
Lösta exempel
A pricing analyst has a 120-row sheet where column E computes a quote with 4 nested IFs, a VLOOKUP into a rate table and ROUND. In workbook mode she presses Name variables from labels, so B2 becomes list_price and C2 becomes customer_tier, generates Python, and runs the test: 118 of 120 formulas match and 2 differ because they use TODAY. She downloads quote_sheet.py for the developers with confidence that the logic is the same.
I korthet
- Kategori: Utvecklare & data
- Körs i webbläsaren, ingen registrering, ingen uppladdning.
- Uppgifterna du anger stannar på din enhet.
- Finns på engelska.
- Innehållet granskades senast:
- Officiell källa: Microsoft Excel functions reference
Vanliga frågor
Which languages are generated?
Python 3 and modern JavaScript. Switch with the Language selector; the variable names stay the same.
Why are there helper functions in the code?
Python and JavaScript behave differently from Excel in rounding, blank cells, text comparison and criteria. The helpers reproduce Excel's rules and are included only when used.
How do I name ranges?
Type a name in the Name in code column. Ranges become lists of rows, so a column of prices is a list of one-item rows.
What does the test compare?
It runs the generated JavaScript with the workbook's values and compares each result with the value Excel stored for that cell.
What if my formula uses a function that is not supported?
The code calls it by its Excel name and the converter lists it, so you can write that function yourself.
Is my workbook uploaded?
No. Parsing, code generation and testing all run in your browser.
