Skip to content
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

Google setup script asks about setting a template. #163

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/integrations/google/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,24 @@ export default async () => {
message:
'Document ID (From the sheet you just created: https://docs.google.com/spreadsheets/d/DOCUMENT_ID/edit)',
validate: (s: string) => (s.length >= 8 ? true : 'Must be at least 8 characters in length.')
},
{
type: 'confirm',
name: 'useTemplate',
message: 'Do you want to setup a template for your Google Sheet?',
},
{
type: prev => (prev ? 'text' : null),
name: 'templateDocumentId',
message: 'Template Document ID (From the URL of the document: https://docs.google.com/spreadsheets/d/DOCUMENT_ID/edit)',
validate: (s: string) => (s.length >= 8 ? true : 'Must be at least 8 characters in length.')
},
{
// The previous value is either "useTemplate" (false) or "templateDocumentId" (true). If it's false, we don't want to ask this question.
type: prev => (prev ? 'text' : null),
name: 'templateSheetTitle',
message: 'Template Sheet Title (The name of the sheet in the template document)',
validate: (s: string) => (s.length >= 1 ? true : 'Must be at least 1 character in length.')
}
])

Expand All @@ -54,6 +72,12 @@ export default async () => {
googleConfig.documentId = credentials.documentId
googleConfig.credentials.clientId = credentials.clientId
googleConfig.credentials.clientSecret = credentials.clientSecret
if (credentials.useTemplate) {
googleConfig.template = {
documentId: credentials.templateDocumentId,
sheetTitle: credentials.templateSheetTitle
}
}

config.integrations[IntegrationId.Google] = googleConfig

Expand Down