pandas-inspired Excel scripting for Office Scripts
Frosts provides a simple and flexible API for importing data from a variety of sources — Excel sheets, ranges, JSON, or raw CSV text. These functions return a DataFrame
you can immediately work with.
📚 Table of Contents
Reads a specific Excel range and returns it as a DataFrame.
✅ Use When:
Example:
const sheet = workbook.getActiveWorksheet();
const df = fr.read_range(workbook.getRange("A1:C6"));
Reads the entire used range of a worksheet and returns it as a DataFrame
.
✅ Use When:
const sheet = workbook.getActiveWorksheet();
const df = fr.read_sheet(sheet);
Note: This function has the same behavior as running
const sheet = workbook.getActiveWorksheet();
const df = fr.read_range(sheet.getUsedRange());
Reads the used range after skipping a number of rows and columns, returning the remaining area as a DataFrame.
n_rows
down and n_cols
to the right.✅ Use When:
const sheet = workbook.getActiveWorksheet();
const df = fr.read_after(sheet, 3, 1); // skips 3 rows and 1 column
Note: This is equivalent to:
const offset = sheet.getUsedRange().getOffsetRange(3, 1).getUsedRange();
const df = fr.read_range(offset);
Reads a JSON string and parses it into a DataFrame.
✅ Use When:
df.to_json()
to export data.Reads a raw CSV string and returns a DataFrame.
errors = "raise"
(default): throws if rows have inconsistent lengths (default).errors = "coerce"
: pads shorter rows with null.start_index
: which line contains the headers (default = 0).line_separator
: newline character, can be \n or \r\n.✅ Use When:
Example:
const csv = "Name,Score\nAlice,88\nBob,90";
const df = fr.read_csv(csv);
Or skipping the first row:
const csv = "Report From 4/1/2024\nName,Score\nAlice,88\nBob,90";
const df = fr.read_csv(csv,"coerce",1);
Converts an array of strings (or mixed values) to numbers.
Non-convertible values become NaN
.
const raw = ["100", "200.5", "invalid", "", null];
const converted = fr.to_numeric(raw);
console.log(converted);
// Output: [100, 200.5, NaN, NaN, NaN]
Frost’s flexible and intuitive design makes reading and writing data a breeze — whether you’re pulling from Excel sheets, parsing raw CSV, or working with JSON APIs. With just a few lines of code, you can go from messy inputs to clean, structured DataFrames ready for transformation, analysis, and export.
Now that you’ve mastered data input, you’re ready to start processing data in the DataFrame object!