1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import process from "node:process";
import { gsheet_call } from "https://esm.town/v/mattx/gsheet_call?v=1";
/* Takes in a few variables and writes it to a Google Sheet,
sending an email each time. I'm using this to send this information
to an RSVP sheet. */
export let weddingAPI = (guest, yesno, count, additional, email) => {
const gsheet_append_example = gsheet_call(
process.env.google_service_account, // This is the file you download from the service account in Google. Just paste it in.
"1lYEDpX63DL12oGBnZ_rTafZxzRRF3jpkvv_Leu0qeqQ", // Sheet ID
"values/A2:D2:append?valueInputOption=RAW", // Append starting after the header
{ values: [[guest, yesno, count, additional, email]] }
);
return console.email(
`${guest}, ${yesno}, ${count}, ${additional}, ${email}`, //body
`New RSVP from ${guest}` //subject
);
};
// Forked from @mattx.gsheet_append_example
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023