-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Palautteet Google Sheetsiin | Antti/feedbacks-to-google-sheets #39
Conversation
… be 'dangerous' so most likely will be changed
…and _isSheetsRequestBodyGiven methods
…n to handle data sending to Google API
…ave no effect, they have been deleted
…in why this was done
…date CHECK THIS comment
…smala/lahjalista into antti/feedbacks-to-google-sheets
export async function sendFeedbackToGoogleSheets({ | ||
feedbackText, | ||
userDetails, | ||
}: { | ||
feedbackText: string; | ||
userUUID: string; | ||
userDetails: User; | ||
}) { | ||
const date = `${new Date().toLocaleDateString('fi-FI')} ${new Date().toTimeString()}`; | ||
const feedbackGiverDetails = `${userDetails.firstName} ${userDetails.lastName}\n${userDetails.email}`; | ||
await SHEETS.spreadsheets.values.append({ | ||
auth: AUTHENTICATION, | ||
spreadsheetId: SPREADSHEET_ID, | ||
range: `Palautteet!A:C`, | ||
requestBody: { | ||
majorDimension: 'ROWS', | ||
values: [[props.feedbackText, props.userUUID, date]], | ||
values: [[feedbackText, feedbackGiverDetails, date]], | ||
}, | ||
valueInputOption: 'USER_ENTERED', | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vaihdoin props
in "suoriin variable nimiin". Tein lisäksi oman variablen, jossa määritetään nuo tiedot palautteen antajasta
Olisiko tästä
range: `Palautteet!A:C`,
tarpeellista tehdä geneeristä vai onko "kovakoodattu" ok? 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kovakoodattu on ok tässä, ohjeistit tuon sheetin nimen readme-tiedostossa hyvin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Valmis mergettäväksi! 🔥 Hienosti toimii, hyvää työtä! 👍
Ensimmäiset versiot (Class- ja "funktio"-versio) Googlen API:n käyttämisestä. Voidaan vaihtaa käyttämään Make.comia, jos tulee tarve