pandas-inspired Excel scripting for Office Scripts
Once your data is prepared and processed, you’ll often want to save it for later use or share it with other systems. Frosts makes it easy to export your DataFrames to common formats like Excel, CSV, and JSON, and just as simple to load them back in.
Writes the DataFrame directly into an Excel worksheet.
worksheet
: The target ExcelScript.Worksheet
object.method
: "o"
(overwrite) or "a"
(append).
"o"
clears and replaces the worksheet contents starting at cell A1."a"
appends the data below the last filled row in the sheet.✅ Use When: You’re working output/save results directly into Excel, incredibly useful for PowerBI tools and automation.
Example:
df.to_worksheet(workbook.getWorksheet("Results"), "o");
This will overwrite the “Results” sheet with the DataFrame.
Exports the DataFrame as a JSON string.
headers
: (default = true
) Whether to include headers in the output (when item = "values"
).âś… Use When:
console.log(df.to_json());
//Output: [["Name","Score"],["Alice",95],["Bob",87]]
Or without headers
console.log(df.to_json(false));
//Output: [["Alice",95],["Bob",87]]
Converts the DataFrame to a CSV-formatted string.
headers
: (default true
) Whether to include the column headers in the output.separator
: Delimiter between columns (defaults to comma).âś… Use When:
Example:
const csv = df.to_csv(true, ",");
Example Output change to table
Name | Score |
---|---|
Alice | 95 |
Bob | 87 |
This method can also be used to convert to TSV or any other separator
df.to_csv(true,"\t");
Returns the DataFrame as a 2D array (array of rows), optionally including headers.
headers
: Whether to include the data headers in the export (default true)âś… Use When:
Example:
const data = df.to_array();
Sample Output
[
["Name", "Score"],
["Alice", 95],
["Bob", 87]
]
You can also choose to omit headers
const data_no_headers = df.to_array(false);
You’ve now mastered everything frosts
, and you’re ready to start building PowerAutomate pipelines and Javascript workflows!