feature: Enhance output options with Google Sheets integration and improve Excel writer functionality

This commit is contained in:
Keith Solomon
2026-05-17 12:05:42 -05:00
parent 379526114c
commit a7cdcf95ae
10 changed files with 375 additions and 14 deletions
+9 -1
View File
@@ -10,6 +10,14 @@ import { NewsletterMessage } from '../parsing/types.js';
const gmailScopes = ['https://www.googleapis.com/auth/gmail.readonly'];
export async function authorizeGmail(credentialsPath: string, tokenPath: string) {
return authorizeGoogleOAuth(credentialsPath, tokenPath, gmailScopes);
}
export async function authorizeGoogleOAuth(
credentialsPath: string,
tokenPath: string,
scopes: string[]
) {
const credentials = JSON.parse(await readFile(expandHome(credentialsPath), 'utf8'));
const clientConfig = credentials.installed ?? credentials.web;
const oauth = new google.auth.OAuth2(
@@ -22,7 +30,7 @@ export async function authorizeGmail(credentialsPath: string, tokenPath: string)
oauth.setCredentials(JSON.parse(await readFile(expandHome(tokenPath), 'utf8')));
return oauth;
} catch {
const url = oauth.generateAuthUrl({ access_type: 'offline', scope: gmailScopes });
const url = oauth.generateAuthUrl({ access_type: 'offline', scope: scopes });
const code = await waitForBrowserCode(url);
const { tokens } = await oauth.getToken(code);
oauth.setCredentials(tokens);