Skip to main content

gsheets.googlesheets.createspreadsheet

Home > @runlightyear/gsheets > GoogleSheets > createSpreadsheet

GoogleSheets.createSpreadsheet() method

This API is in beta and may contain contain bugs. Can be used in production with caution.

Creates a spreadsheet, returning the newly created spreadsheet.

Signature:
createSpreadsheet(props: CreateSpreadsheetProps): Promise<CreateSpreadsheetResponse>;

Parameters

ParameterTypeDescription
propsCreateSpreadsheetProps
Returns:

Promise<CreateSpreadsheetResponse>

Example

Create a spreadsheet

import { defineAction } from "@runlightyear/lightyear";
import { GoogleSheets } from "@runlightyear/gsheets";

defineAction({
name: "createSpreadsheet",
title: "Create Spreadsheet",
apps: ["gsheets"],
variables: ["title"],
run: async ({ auths, variables }) => {
const gsheets = new GoogleSheets({
auth: auths.gsheets,
});

const response = await gsheets.createSpreadsheet({
title: variables.title!,
});

console.log("Response: ", response.data);
},
});