Public
Edited
Dec 24
4 stars
Insert cell
Insert cell
Insert cell
client_id = "134940173616-9idertc5irfihj7jv49gb7msejjctu1t.apps.googleusercontent.com"
Insert cell
Insert cell
listFiles({
q: `'1EKRbZj-g6AeL2KG_87fJmLjKEl91jmXZ' in parents`,
fields: "nextPageToken, files(id, name, mimeType, parents, properties)",
spaces: "drive"
})
Insert cell
Insert cell
sheet.getRange("Women's Short")
Insert cell
sheet = spreadsheet("1hW0OZtsNQqVvs6FH-P-ZAmwjkhnVrnfzts0D3tgPRtA")
Insert cell
Insert cell
valuesToMap.map((entry) => Object.fromEntries(entry))
Insert cell
mapToRange(valuesToMap)
Insert cell
valuesToMap = rangeToMap(values)
Insert cell
values = {
const { result } = await gapi.client.sheets.spreadsheets.values.get({
spreadsheetId: "1hW0OZtsNQqVvs6FH-P-ZAmwjkhnVrnfzts0D3tgPRtA",
range: "Women's Short",
valueRenderOption: "FORMATTED_VALUE"
});
return result.values;
}
Insert cell
Insert cell
rangeToMap = (range) => {
const columns = range[0];
return range.slice(1).map((row) =>
columns.reduce((result, column, index) => {
let value = row[index] || null;
if (value === "TRUE") {
value = true;
}
if (value === "FALSE") {
value = false;
}
result.set(column, value);
return result;
}, new Map())
);
}
Insert cell
mapToRange = (data) => {
const columns = [...data[0].keys()];
return [
columns,
...data.map((row) => {
const values = columns.map((column) => {
const value = row.get(column);
if (!value) {
return "";
}
if (Array.isArray(value)) {
return value.join(",");
}
if (typeof value == "boolean" && value === true) {
return "TRUE";
}
if (typeof value == "boolean" && value === false) {
return "FALSE";
}
if (typeof value === "object") {
return JSON.stringify(value);
}
return value;
});
return values;
})
];
}
Insert cell
import { listFiles } with { gapi } from '@gnestor/google-drive'
Insert cell
import {
spreadsheet,
} with { gapi } from "@gnestor/google-sheets"
Insert cell
import { gapi, authButton } with { client_id } from "@gnestor/google-auth"
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more