Advertisement
Guest User

sadasdsa

a guest
May 20th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. 'use strict';
  2.  
  3. module.exports.hello = (event, context, callback) => {
  4. const response = {
  5. statusCode: 200,
  6. body: JSON.stringify({
  7. message: 'Hello!!!!!!!!!!!!!',
  8. }),
  9. };
  10.  
  11. callback(null, response);
  12. };
  13.  
  14. module.exports.sheet = (event, context, callback) => {
  15. /*
  16. const response = {
  17. statusCode: 200,
  18. body: JSON.stringify({
  19. message: 'sheet testi',
  20. }),
  21. };
  22. */
  23.  
  24. var GoogleSpreadsheet = require('google-spreadsheet');
  25. var creds = require('./client_secret.json');
  26.  
  27. // Create a document object using the ID of the spreadsheet - obtained from its URL.
  28. var doc = new GoogleSpreadsheet('1fAEVrInuFdYaDSpW6LoLlJ9LOTLCQwMUbnYpdadvRqmQq6nc');
  29.  
  30. // Authenticate with the Google Spreadsheets API.
  31. doc.useServiceAccountAuth(creds, function (err) {
  32.  
  33. // Get all of the rows from the spreadsheet.
  34. doc.getRows(1, function (err, rows) {
  35. console.log(rows);
  36. });
  37. });
  38. callback(null, rows);
  39. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement