Skip to content

Inspecting Data - BareFrame.display

BareFrame.display returns a markdown-style table of the DataFrame contents. It is the recommended way to inspect data during development.

JavaScript
const df = gaslamp.BareFrame.fromSheet(sheet);
console.log(df.display());
// | name  | age | city    |
// | ----- | --- | ------- |
// | Alice | 25  | Tokyo   |
// | Bob   | 30  | Osaka   |
// | Carol | 28  | Fukuoka |
// ... and 97 more rows

Without gaslamp

Inspecting raw getValues() output in the GAS log is hard to read. Rows appear as a flat comma-separated string with no column labels:

JavaScript
const values = sheet.getDataRange().getValues();
console.log(values);
// [[name, age, city], [Alice, 25, Tokyo], [Bob, 30, Osaka], ...]

To see column names alongside values, you need to build the output manually:

JavaScript
const headers = values[0];
const rows = values.slice(1);
const lines = rows.map(row =>
  headers.map((h, i) => `${h}: ${row[i]}`).join(", ")
);
console.log(lines.join("\n"));
// name: Alice, age: 25, city: Tokyo
// name: Bob, age: 30, city: Osaka

With gaslamp

display() formats the DataFrame as a readable table in one call. Column names are shown as headers, values are aligned, and long DataFrames are truncated automatically.

JavaScript
const df = gaslamp.BareFrame.fromSheet(sheet);
console.log(df.display());
// | name  | age | city    |
// | ----- | --- | ------- |
// | Alice | 25  | Tokyo   |
// | Bob   | 30  | Osaka   |
// | Carol | 28  | Fukuoka |
// ... and 97 more rows

Limiting rows and truncating values

By default, display shows up to 10 rows and truncates cell values longer than 20 characters. Pass arguments to adjust both limits:

JavaScript
// Show up to 5 rows, truncate at 30 characters per cell
console.log(df.display(5, 30));

Next Steps