Spreadsheet Table Transformations from Examples

Abstract

Every day, millions of computer end-users need to perform tasks over large, tabular data, yet lack the programming knowledge to do such tasks automatically. In this work, we present an automatic technique that takes from a user an example of how the user needs to transform a table of data, and provides to the user a program that implements the transformation described by the example. In particular, we present a language of programs TableProg that can describe transformations that real users require. We then present an algorithm ProgOfEx that takes an example input and output table, and infers a program in TableProg that implements the transformation described by the example. When the program is applied to the example input, it reproduces the example output. When the program is applied to another, potentially larger, table with a similar layout as the example input table, then the program produces a corresponding table with a layout that is similar to the example output table. A user can apply ProgOfEx interactively, providing multiple small examples to obtain a program that implements the transformation that the user desires. Moreover, ProgOfEx can reason about noisy examples that contain errors.

To evaluate the practicality of TableProg and ProgOfEx, we implemented ProgOfEx as a module for the Microsoft Excel spreadsheet program. We applied the module to automatically implement over 50 table transformations specified by end-users through examples on online Excel help forums. In seconds, ProgOfEx found programs that satisfied the examples and could be applied to larger input tables. This experience demonstrates that TableProg and ProgOfEx can significantly automate the tasks over tabular data that users need to perform.