Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- module.exports.hello = (event, context, callback) => {
- const response = {
- statusCode: 200,
- body: JSON.stringify({
- message: 'Hello!!!!!!!!!!!!!',
- }),
- };
- callback(null, response);
- };
- module.exports.sheet = (event, context, callback) => {
- /*
- const response = {
- statusCode: 200,
- body: JSON.stringify({
- message: 'sheet testi',
- }),
- };
- */
- var GoogleSpreadsheet = require('google-spreadsheet');
- var creds = require('./client_secret.json');
- // Create a document object using the ID of the spreadsheet - obtained from its URL.
- var doc = new GoogleSpreadsheet('1fAEVrInuFdYaDSpW6LoLlJ9LOTLCQwMUbnYpdadvRqmQq6nc');
- // Authenticate with the Google Spreadsheets API.
- doc.useServiceAccountAuth(creds, function (err) {
- // Get all of the rows from the spreadsheet.
- doc.getRows(1, function (err, rows) {
- console.log(rows);
- });
- });
- callback(null, rows);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement