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

easy-google-drive

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easy-google-drive

  • 0.0.5
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

About easy-google-drive

This repository is ruby library to use google drive of file managmenemt and asscess to spread sheet. This libary use google DriveV3 and Sheet API V4. The library saves "gdrive.dat" in root folder of google drive.

how to use

  1. install google drive api for ruby.
$ sudo gem install easy-google-drive

recommend to git it for sample execution.

$ git clone git://github.com/NaotakaSaito/easy-google-drive
  1. setting of google drive

  2. access to https://console.developers.google.com/

  3. login google account

  4. click to "プロジェクトを選択"

  5. click "+" button and create new projectchoose_project

  6. click "API Manager" and "Library". Then choose Drive API and Sheet API google_drive_api

  7. Enable "Drive API" and "Sheet API"

  8. Click "認証情報" and click "認証情報を作成", Then Choose "OAuth Client ID"

  9. click "同意画面を設定". Input "service name".

  10. choose "その他" and click "作成"

  11. click download button. And change file name to "client_secret.json"

  12. move the file to project folder.

  13. execute sample program

$ ruby test_drive.rb
  1. execute test_drive.rb
  2. Copy URL for authorization on display. And paste browser. And click twice.
  3. Display "token" on browser. And copy "token", then paste it on console. Then display URL for authorization. The URL is copied and paste to URL in browser.Then please copy token code in browser and paste on console display.

APIs

Drive APIs

require 'easy-google-drive'
myDrive = EasyGoogleDrive::Drive.new
cd (change directory)
commandoperation
myDrive.cd("directory")change directory
myDrive.cd("$")move to shared folder
myDrive.cd("~")move to root foloder of my drive
myDrive.cd("~/directory")move to directory on root foloder of my drive
mkdir (make directory)
commandoperation
myDrive.mkdir("directory")make directory named "directory"
rm (remove file)
commandoperation
myDrive.rm("file")delete file
myDrive.rm("~/directory/file")delete file
get (get file from google drive)
commandoperation
myDrive.get("src","dst")get "src" in google drive. "dst" is destination file name.
send (send file to google driver)
commandoperation
myDrive.send("src","dst")send "src" in local drive and put "dst" in google drive.

Spreadsheet APIs

require 'easy-google-drive'
mySheet = EasyGoogleDrive::Spreadsheet.new
open (open file)
commandoperation
mySheet.open("file")open "file".
addNewLine(sheet,data) (add data at the bottom line in sheet)
commandoperation
mySheet.addNewLine("sheet",data)Add new line.
"sheet": sheet name
data: Array data.
(example)
  • mySheet.addNewLine("",[10,100,1000]) :
    add [10,100,1000] to new line in default sheet.
  • mySheet.addNewLine("Sheet2",[10,100,1000]) :
    add [10,100,1000] to new line in "sheet2"
getData(sheet,range) (open file)
commandoperation
mySheet.getData("sheet","range")get data in "range" from "sheet"
  • mySheet.getData("","A:E") :
    get all data of "A:E" from default sheet
  • mySheet.getData("Sheet2","A2:E5") :
    get data in "A2:E5" from "Sheet2"

Tips

The authorization data is stored in "~/.credentials/"

FAQs

Package last updated on 25 May 2017

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