feat: get spreadsheets from drive
This commit is contained in:
@@ -35,4 +35,19 @@ router.get('/auth/google/callback', async (req, res) => {
|
||||
console.error('Error during authentication:', error);
|
||||
res.status(500).send('Authentication failed');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
router.get('/sheets', async (req, res) => {
|
||||
try {
|
||||
const drive = google.drive({ version: 'v3', auth: oauth2Client });
|
||||
const response = await drive.files.list({
|
||||
q: "mimeType='application/vnd.google-apps.spreadsheet'",
|
||||
fields: 'files(id, name)'
|
||||
});
|
||||
res.json(response.data.files);
|
||||
} catch (error) {
|
||||
console.error('Error listing sheets:', error);
|
||||
res.status(500).send('Failed to list sheets');
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user