Table I: The initial prompt used to query LLMs to generate step-by-step solutions. The prompt is formatted as a multi-turn dialogue between a user and an agent. Note that the final turn of this prompt is an example task instruction and can be replaced with other task instructions to generate solutions corresponding to the task. For clarity, redundant contents are left out.
{content:You are a spreadsheet agent who can find proper action APIs from the API document based on the language instructions. Here is the API document: Write #Args: (range: str, value: str) Usage: Write value into a range. The string in value also can be excel formulas. CopyPaste #Args: (source: str, destination: str) Usage: Copy the source range and paste into the destination range. CutPaste #Args: (source: str, destination: str) Usage: Cut the source range and paste into the destination range. SetHyperlink #Args: (source: str, url: str) Usage: Set hyperlink for the source range. RemoveHyperlink #Args: (source: str) Usage: Remove hyperlink for the source range. AutoFill #Args: (source: str, destination: str) Usage: Auto fill the destination range with the source range. Sort #Args: (source: str, key1: str, order: str='asc', orientation: str='column') Usage: Sort the source range by key1. Filter #Args: (source: str, fieldIndex: int, criteria: str) Usage: Filter the source range based on fieldIndex by criteria. DeleteFilter #Args: () Usage: Delete all filters. MoveRow #Args: (source: int, destination: int) Usage: Move the source row to the destination row. MoveColumn #Args: (source: int, destination: int) Usage: Move the source column to the destination column. RemoveDuplicate #Args: (source: str, key: int) Usage: Remove duplicate values in the source range based on the key. SetFormat #Args: (source: str, font: str = None, fontSize: float = None, color: str = None, fillColor: int = None, bold: bool = None, italic: bool = None, underline: bool = None, horizontalAlignment: str = None) Usage: Set format for the source range. If you want to set data type, please use 'SetDataType' API. SetDataType #Args: (source: str, dataType: str) Usage: Set data type for the source range. SetCellMerge #Args: (source: str, merge: bool) Usage: Toggle cell merge for the source range. Delete #Args: (source: str, region: str) Usage: Deletes a cell or range of cells. Clear #Args: (source: str) Usage: Clear the content and the formatting of a Range. AutoFit #Args: (source: str) Usage: Auto fit the width and height of all cells in the range. ResizeRowColumn #Args: (source: str, width: float = None, height: float = None) Usage: Resize the width and height of all cells in the range. SetConditionalFormat #Args: (source: str, formulae: str, bold: nool = None, color: str = None, fillColor: str = None, italic: bool = None, underline: bool = None) Usage: Set conditional format for the source range. ... (Leave out for clarity) FreezePanes #Args: (source: str) Usage: Freeze panes for current window. CreateChart #Args: (source: str, destSheet: str, chartType: str, chartName: str, XField: int = None, YField: List[int] = ]) Usage: Create a chart based on the data from the source range. Please note that if you use data from a pivot table to create a chart, use the API 'CreateChartFromPivotTable' instead. ... (Leave out for clarity) Requirements: 1. The user will show you the headers and row numbers of sheets for you reference. 2. Please provide step-by-step solutions with explanations. 3. You can only be allowed to use the action APIs listed above. You cannot use any other APIs. Do not generate any new action APIs. 4. It should only return one step at a time and each step should only contain one action API. 5. Please add @ both before and after each function call to indicate that the content between the two @ characters is one function call, like @Function1(@), Function2(@). 6. The address of a range must contain the sheet name, due to that there may be multiple sheets in a workbook. 7. You can only call the action APIs and directly use the values in the sheet. You cannot use any other variables., role:system} {content:Instruction: In column D, calculate the profit for each week. Then format the numbers with Accounting Number Format. Sheet state: Sheet "Sheet1" (active) has 3 columns (Headers are A: "Week", B: "Sales", C: "COGS") and 11 rows (the row 1 is the header row). Please provide the first step., role:user} {content:Step 1. Create a new column D. Action API: @Write(range="Sheet1!D1", value="Profit")@, role:assistant} {content:Sheet state: Sheet "Sheet1" has 4 columns (Headers are A: "Week", B: "Sales", C: "COGS", D: "Profit") and 11 rows (the row 1 is the header row). If task is not finished, please provide the next step, otherwise, please type "Done!". role:user} {content:Step 2. Profit is sales minus COGS. Action API: @Write(range="Sheet1!D2", value="B2-C2")@, role:assistant} {content:Sheet state: Sheet "Sheet1" has 4 columns (Headers are A: "Week", B: "Sales", C: "COGS", D: "Profit") and 11 rows (the row 1 is the header row). If task is not finished, please provide the next step, otherwise, please type "Done!". role:user} {content:Step 3. Fill other rows. Action API: @AutoFillsource="Sheet1!D2", destination="D2:D11")@, role:assistant} {content:Sheet state: Sheet "Sheet1" has 4 columns (Headers are A: "Week", B: "Sales", C: "COGS", D: "Profit") and 11 rows (the row 1 is the header row). If task is not finished, please provide the next step, otherwise, please type "Done!". role:user} {content:Step 4. Change the format of the results as these are accounting values. Action API: @SetDataType(range="Sheet1!D2:D11", dataType="currency")@, role:assistant} {content:Sheet state: Sheet "Sheet1" has 4 columns (Headers are A: "Week", B: "Sales", C: "COGS", D: "Profit") and 11 rows (the row 1 is the header row). If task is not finished, please provide the next step, otherwise, please type "Done!". role:euser} {content:Done!, role:assistant} (The following turn shows the context, instruction, and sheet state of the task to be solved) {content:My workbook has two tables. Sheet "Sheet1" records the sales of a boomerang company. Sheet "Retail Price" lists the retail prices for all products. Instruction: I want to calculate the revenue for each transaction in the sales table considering corresponding retail price and discount. Please help me do this in a new column with header "Revenue". Then create a pivot table at A1 in a new sheet to show the counts of the websites on which boomerangs were sold. Finally, plot a bar chart in this new sheet for the pivot table with chart title "Sales frequency by website" and without legends. Sheet state: Sheet "Sheet1" has 6 columns (Headers are A: "Date Time", B: "Web Site", C: "Product", D: "Type", E: "Quantity", F: "Discount") and 36 rows (1 header row and 35 data rows). Sheet "Retail Price" has 2 columns (Headers are A: "Product", B: "Retail Price") and 23 rows (1 header row and 22 data rows). Please provide the first step., role:euser}