Integrating external program code with spreadsheet application
A data processing system implements receiving a first input in a spreadsheet in a spreadsheet application, detecting an indication that the first input includes first executable program code, analyzing the first executable program code to identify first references to one or more first elements of the spreadsheet in the first executable program code, requesting spreadsheet data associated with the one or more first elements of the spreadsheet from the spreadsheet application, receiving the spreadsheet data from the spreadsheet application; executing the first executable program code using the spreadsheet data referenced in the first executable program code to obtain a first program code result and causing the spreadsheet application to display the first program code result in the spreadsheet application.
1 . A data processing system comprising:
a processor; and
a machine-readable storage medium storing executable instructions that, when executed, cause the processor alone or in combination with other processors to perform operations of:
receiving a first input in a spreadsheet in a spreadsheet application;
detecting an indication that the first input includes first executable program code, the first executable program code being associated with a first cell of the spreadsheet application and storing the first executable program code within the spreadsheet by storing the first executable program code in metadata associated with the first cell;
presenting the first executable program code in a code editor panel of a user interface of the spreadsheet application;
detecting a selection of one or more first elements of the spreadsheet in the user interface of the spreadsheet application;
highlighting the one or more first elements of the spreadsheet in the user interface of the spreadsheet application responsive to detecting the selection of the one or more first elements;
automatically updating the first executable program code to include one or more references to the one or more first elements of the spreadsheet responsive to detecting the selection of the one or more first elements to generate updated first executable program code;
presenting the updated first executable program code in the code editor panel of the user interface of the spreadsheet application;
highlighting the one or more references to the one or more first elements in the code editor panel of the user interface of the spreadsheet application;
analyzing the first executable program code to identify first references to one or more first elements of the spreadsheet in the first executable program code;
requesting spreadsheet data associated with the one or more first elements of the spreadsheet from the spreadsheet application;
receiving the spreadsheet data from the spreadsheet application;
executing the first executable program code using the spreadsheet data referenced in the first executable program code to obtain a first program code result;
causing the spreadsheet application to display the first program code result in the spreadsheet application;
monitoring changes to the spreadsheet that affect the one or more first elements of the spreadsheet;
detecting a change to the spreadsheet that updates the first references to the one or more first elements in the spreadsheet;
generating updated references to the one or more first elements based on the change to the spreadsheet; and
automatically updating the first executable program code with the updated references in response to detecting the change the spreadsheet.
2 . The data processing system of claim 1 , wherein the machine-readable storage medium further includes instructions configured to cause the processor alone or in combination with other processors to perform operations of:
causing the spreadsheet application to present the first executable program code in a first editor pane in the spreadsheet application;
detecting a first user input selecting a first reference to the one or more first elements; and
causing the spreadsheet application to highlight the one or more first elements in the spreadsheet in response to detecting the first user input.
3 . The data processing system of claim 2 , wherein the machine-readable storage medium further includes instructions configured to cause the processor alone or in combination with other processors to perform operations of:
detecting a second user input via a first control element of the first editor pane;
configuring the first editor pane and the spreadsheet application to operate in a first editor mode responsive to detecting the second user input, the first editor mode causing the spreadsheet application to monitor user selections of elements within the spreadsheet and to provide references to the user selections to the first editor pane;
detecting a third user input selecting one or more second elements of the spreadsheet;
providing references to the one or more second elements to the first editor pane; and
automatically inserting a representation of the references to the one or more second elements into the first executable program code.
4 . The data processing system of claim 3 , wherein the machine-readable storage medium further includes instructions configured to cause the processor alone or in combination with other processors to perform operations of:
receiving a second input associated with a second cell in the spreadsheet in the spreadsheet application;
detecting the indication that the second input includes second executable program code;
analyzing the second executable program code to identify second references to one or more second elements of the spreadsheet in the second executable program code;
requesting spreadsheet data associated with the one or more second elements of the spreadsheet from the spreadsheet application;
receiving the spreadsheet data from the spreadsheet application;
executing the second executable program code using the spreadsheet data referenced in the second executable program code to obtain a second program code result;
causing the spreadsheet application to store the second program code result in the spreadsheet application; and
causing the spreadsheet application to present the first executable program code in a second editor pane in the spreadsheet application.
5 . The data processing system of claim 4 , wherein the machine-readable storage medium further includes instructions configured to cause the processor alone or in combination with other processors to perform operations of:
causing the spreadsheet application to display a code editor panel, wherein the code editor panel presents the first editor pane associated with the first executable program code and the second editor pane associated with the second executable program code in an order of execution of the first executable program code and the second executable program code.
6 . The data processing system of claim 5 , wherein the machine-readable storage medium further includes instructions configured to cause the processor alone or in combination with other processors to perform operations of:
detecting a third user input via a second control element of the code editor panel;
causing the code editor panel to display a third editor pane for third executable program code;
receiving an indication of a third cell of the spreadsheet to associate with the third executable program code;
receiving third program code via the third editor pane; and
associating the third program code with the third cell of the spreadsheet.
7 . A method implemented in a data processing system for integrating executable program code with a spreadsheet application, the method comprising:
receiving a first input in a spreadsheet in a spreadsheet application;
detecting an indication that the first input includes first executable program code, the first executable program code being associated with a first cell of the spreadsheet application and storing the first executable program code within the spreadsheet by storing the first executable program code in metadata associated with the first cell;
presenting the first executable program code in a code editor panel of a user interface of the spreadsheet application;
detecting a selection of one or more first elements of the spreadsheet in the user interface of the spreadsheet application;
highlighting the one or more first elements of the spreadsheet in the user interface of the spreadsheet application responsive to detecting the selection of the one or more first elements;
automatically updating the first executable program code to include one or more references to the one or more first elements of the spreadsheet responsive to detecting the selection of the one or more first elements to generate updated first executable program code;
presenting the updated first executable program code in the code editor panel of the user interface of the spreadsheet application;
highlighting the one or more references to the one or more first elements in the code editor panel of the user interface of the spreadsheet application;
analyzing the first executable program code to identify first references to one or more first elements of the spreadsheet in the first executable program code;
requesting spreadsheet data associated with the one or more first elements of the spreadsheet from the spreadsheet application;
receiving the spreadsheet data from the spreadsheet application;
executing the first executable program code using the spreadsheet data referenced in the first executable program code to obtain a first program code result;
causing the spreadsheet application to display the first program code result in the spreadsheet application;
monitoring changes to the spreadsheet that affect the one or more first elements of the spreadsheet;
detecting a change to the spreadsheet that updates the first references to the one or more first elements in the spreadsheet;
generating updated references to the one or more first elements based on the change to the spreadsheet; and
automatically updating the first executable program code with the updated references in response to detecting the change the spreadsheet.
8 . The method of claim 7 , further comprising:
causing the spreadsheet application to present the first executable program code in a first editor pane in the spreadsheet application;
detecting a first user input selecting a first reference to the one or more first elements; and
causing the spreadsheet application to highlight the one or more first elements in the spreadsheet in response to detecting the first user input.
9 . The method of claim 8 , further comprising:
detecting a second user input via a first control element of the first editor pane;
configuring the first editor pane and the spreadsheet application to operate in a first editor mode responsive to detecting the second user input, the first editor mode causing the spreadsheet application to monitor user selections of elements within the spreadsheet and to provide references to the user selections to the first editor pane;
detecting a third user input selecting one or more second elements of the spreadsheet;
providing references to the one or more second elements to the first editor pane; and
automatically inserting a representation of the references to the one or more second elements into the first executable program code.
10 . The method of claim 9 , further comprising:
receiving a second input associated with a second cell in the spreadsheet in the spreadsheet application;
detecting the indication that the second input includes second executable program code;
analyzing the second executable program code to identify second references to one or more second elements of the spreadsheet in the second executable program code;
requesting spreadsheet data associated with the one or more second elements of the spreadsheet from the spreadsheet application;
receiving the spreadsheet data from the spreadsheet application;
executing the second executable program code using the spreadsheet data referenced in the second executable program code to obtain a second program code result;
causing the spreadsheet application to store the second program code result in the spreadsheet application; and
causing the spreadsheet application to present the first executable program code in a second editor pane in the spreadsheet application.