Skip to main content
QUICK REVIEW

[Paper Review] SpreadsheetCoder: Formula Prediction from Semi-structured Context

Xinyun Chen, Petros Maniatis|arXiv (Cornell University)|Jun 26, 2021
Spreadsheets and End-User ComputingComputer Science7 citations
TL;DR

SpreadsheetCoder is a BERT-based neural model that predicts spreadsheet formulas using semi-structured tabular context, including headers and cell values, by encoding both row-wise and column-wise relational structures. It achieves 42.51% top-1 full-formula accuracy and assists 82% more users than a rule-based system in Google Sheets, demonstrating the value of rich tabular context in formula prediction.

ABSTRACT

Spreadsheet formula prediction has been an important program synthesis problem with many real-world applications. Previous works typically utilize input-output examples as the specification for spreadsheet formula synthesis, where each input-output pair simulates a separate row in the spreadsheet. However, this formulation does not fully capture the rich context in real-world spreadsheets. First, spreadsheet data entries are organized as tables, thus rows and columns are not necessarily independent from each other. In addition, many spreadsheet tables include headers, which provide high-level descriptions of the cell data. However, previous synthesis approaches do not consider headers as part of the specification. In this work, we present the first approach for synthesizing spreadsheet formulas from tabular context, which includes both headers and semi-structured tabular data. In particular, we propose SpreadsheetCoder, a BERT-based model architecture to represent the tabular context in both row-based and column-based formats. We train our model on a large dataset of spreadsheets, and demonstrate that SpreadsheetCoder achieves top-1 prediction accuracy of 42.51%, which is a considerable improvement over baselines that do not employ rich tabular context. Compared to the rule-based system, SpreadsheetCoder assists 82% more users in composing formulas on Google Sheets.

Motivation & Objective

  • To address the limitations of existing formula prediction methods that rely solely on input-output examples and ignore structural and semantic context in spreadsheets.
  • To develop a neural model that leverages both headers and semi-structured tabular data as implicit specifications for formula generation.
  • To improve formula prediction accuracy by modeling dependencies across rows and columns in real-world, less-structured spreadsheet tables.
  • To enable more flexible formula generation by supporting a wide range of operators and cell references, beyond constrained DSLs.
  • To demonstrate practical utility by evaluating on real-world spreadsheets and showing measurable user assistance gains over rule-based systems.

Proposed method

  • A BERT-based encoder is fine-tuned on spreadsheet tables to generate contextual embeddings for each cell, incorporating both row and column context through separate encoding paths.
  • The model processes tabular input by tiling multiple rows and columns across multiple forward passes to handle large tables beyond BERT’s 512-token limit.
  • A two-stage decoding process first generates a formula sketch (without concrete cell references), then predicts the appropriate cell ranges to complete the formula.
  • The model is pre-trained on English text corpora to better encode natural language headers, enhancing semantic understanding of table metadata.
  • The architecture supports over 100 spreadsheet operators and flexible cell referencing, enabling generation of full, executable formulas.
  • The model is trained and evaluated on a large-scale benchmark of real, publicly shared spreadsheets within the organization.

Experimental results

Research questions

  • RQ1Can incorporating table headers and semi-structured data improve spreadsheet formula prediction beyond input-output examples?
  • RQ2How effective is a BERT-based architecture in modeling two-dimensional relational structure in semi-structured spreadsheets?
  • RQ3To what extent does modeling cross-row and cross-column dependencies enhance formula prediction accuracy?
  • RQ4Can a neural model outperform rule-based systems in real-world formula composition tasks?
  • RQ5How does the inclusion of rich tabular context compare to traditional programming-by-example in terms of practical user assistance?

Key findings

  • SpreadsheetCoder achieves a top-1 full-formula accuracy of 42.51%, significantly outperforming baseline methods that do not use rich tabular context.
  • The model achieves 57.41% top-1 formula-sketch accuracy, indicating strong performance in predicting the structural form of formulas.
  • Compared to a rule-based system, SpreadsheetCoder assists 82% more users in composing formulas on Google Sheets, demonstrating real-world practical impact.
  • Including table headers as part of the input context leads to a substantial improvement in prediction performance, highlighting their importance as semantic cues.
  • The two-stage decoding process—first generating a sketch, then predicting cell references—enables accurate and flexible formula generation.
  • The model generalizes well to diverse spreadsheet structures, including tables with inconsistent row schemas and non-independent data blocks.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.