Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

google-drive-spreadsheet

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-drive-spreadsheet

API to access Google Drive API from Node.js

  • 1.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
36
increased by111.76%
Maintainers
1
Weekly downloads
 
Created
Source

google-drive-spreadsheet

A library to access Google Drive Spreadsheet API from Node.js https://github.com/bgdavidx/google-drive-spreadsheet

npm install --save google-drive-spreadsheet

API

Promise version (via Bluebird):

var Spreadsheet = require('google-drive-spreadsheet')

new Spreadsheet(SPREADSHEET_ID).getRowsAsync(1).then(function(rows) {
  console.log(rows)
}).catch(function(err) {
  console.log('Error', err)
})

Async-Await version (via babel-runtime):

import Spreadsheet from 'google-drive-spreadsheet'

const fn = async () => {
  const ss = new Spreadsheet(SPREADSHEET_ID)
  
  try {
    const rows = await ss.getRowsAsync(1)
    
    console.log(rows)
  } catch (err) {
    console.log('Error', err)
  }
}

Callback version:

var Spreadsheet = require('google-drive-spreadsheet')

new Spreadsheet(SPREADSHEET_ID).getRows(1, function(err, rows) {
  if (err) {
    console.log('Error', err)
  } else {
    console.log(rows)
  }
})


API

Note: Promisified versions also available, omit callback and add async, for example getRows(worksheetId, options, callback) -> getRowsAsync(worksheetId, options)

Spreadsheet.prototype.getRows(worksheetId, options, callback) =>

returns an array of SpreadsheetRow from the given worksheetId.

example return:

[
  {
    "_xml": "<entry><id>https://spreadsheets.google.com/feeds/list/1JCqI21cPaw3hn53EC3XdsP_7UacwKxGi5_i472FP-DU/1/public/values/cokwr</id><updated>2015-08-13T07:04:55.399Z</updated><category scheme='http://schemas.google.com/spreadsheets/2006' term='http://schemas.google.com/spreadsheets/2006#list'/><title type='text'>Hello</title><content type='text'>columntwo: world, columnthree: !</content><link rel='self' type='application/atom+xml' href='https://spreadsheets.google.com/feeds/list/1JCqI21cPaw3hn53EC3XdsP_7UacwKxGi5_i472FP-DU/1/public/values/cokwr'/><gsx:columnone>Hello</gsx:columnone><gsx:columntwo>world</gsx:columntwo><gsx:columnthree>!</gsx:columnthree></entry>",
    "id": "https://spreadsheets.google.com/feeds/list/1JCqI21cPaw3hn53EC3XdsP_7UacwKxGi5_i472FP-DU/1/public/values/cokwr",
    "title": "Hello",
    "content": "columntwo: world, columnthree: !",
    "_links": [],
    "columnone": "Hello",
    "columntwo": "world",
    "columnthree": "!"
  }
]
Spreadsheet.prototype.getInfo(callback) =>

returns info for each worksheet in the spreadsheet.

Spreadsheet.prototype.addRow(worksheetId, data, callback) =>

adds a row to the worksheet with the given worksheetId.

Spreadsheet.prototype.getCells(worksheetId, options, callback) =>

returns cells from the spreadsheet.

SpreadsheetWorksheet.prototype.getRows(options, callback) =>

returns rows from the spreadsheet

SpreadsheetWorksheet.prototype.getCells(options, callback) =>

returns rows from the worksheet.

SpreadsheetWorksheet.prototype.addRow(data, callback) =>

adds a row to the worksheet.

SpreadsheetRow.save(callback) =>

saves the modified spreadsheet row to the cloud.

SpreadsheetRow.del(callback) =>

deletes the row from the cloud.

SpreadsheetCell.setValue(newValue, callback) =>

updates the value of the cell in the cloud.

SpreadsheetCell.save(callback) =>

saves the cell to the cloud.

SpreadsheetCell.del(callback) =>

deletes the cell from the cloud.

Keywords

FAQs

Package last updated on 13 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc