Spaces:
Running
Running
File size: 704 Bytes
3d777f1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | const { google } = require('googleapis');
require('dotenv').config();
const auth = new google.auth.GoogleAuth({
keyFile: 'credentials.json',
scopes: ['https://www.googleapis.com/auth/spreadsheets'],
});
const sheets = google.sheets({ version: 'v4', auth });
const SPREADSHEET_ID = process.env.SPREADSHEET_ID;
async function checkSheet() {
try {
const response = await sheets.spreadsheets.values.get({
spreadsheetId: SPREADSHEET_ID,
range: 'Sheet1!A1:L30',
});
console.log('All rows fetched:');
response.data.values.forEach((row, idx) => {
console.log(`Row ${idx + 1}:`, row);
});
} catch (error) {
console.error('Error:', error);
}
}
checkSheet();
|