рд╕реНрдкреНрд░реЗрдбрд╢реАрдЯ рдЕрднреА рднреА рдбреЗрдЯрд╛ рдХреЗ рд╕рд╛рде рдХрд╛рдо рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рдПрдХ рдХрд╛рдлреА рд▓реЛрдХрдкреНрд░рд┐рдп рдЙрдкрдХрд░рдг рд╣реИ, рдФрд░ рд╡рд┐рднрд┐рдиреНрди рд╕реНрдкреНрд░реЗрдбрд╢реАрдЯ рдкреНрд░реЛрд╕реЗрд╕рд░ рдХреЗ рдмреАрдЪ, Google рд╢реАрдЯ рд╕рдмрд╕реЗ рд▓реЛрдХрдкреНрд░рд┐рдп рд╣реИрдВред рд╕рдмрд╕реЗ рдкрд╣рд▓реЗ, рдпрд╣ рдПрдХ рдирд┐: рд╢реБрд▓реНрдХ рдЙрдкрдХрд░рдг рд╣реИ, рдФрд░ рджреВрд╕рд░реА рдмрд╛рдд, Google рд╢реАрдЯ рдХреА рдХрд╛рд░реНрдпрдХреНрд╖рдорддрд╛ рдХрд╛рдлреА рд╡реНрдпрд╛рдкрдХ рд╣реИ, рдФрд░ рд╡реЗ рдЖрдкрдХреЛ рдбреЗрдЯрд╛ рдСрдирд▓рд╛рдЗрди рдПрдХреНрд╕реЗрд╕ рдХрд░рдиреЗ рдХрд╛ рдЕрд╡рд╕рд░ рдкреНрд░рджрд╛рди рдХрд░рддреЗ рд╣реИрдВред
рдЗрд╕ рд▓реЗрдЦ рдореЗрдВ, рд╣рдо рд╕рдордЭреЗрдВрдЧреЗ рдХрд┐ рдкреИрдХреЗрдЬ рдХреЗ рдЙрдкрдпреЛрдЧ рд╕реЗ рдкреНрд░реЛрдЧреНрд░рд╛рдорд┐рдВрдЧ рд▓реИрдВрдЧреНрд╡реЗрдЬ R рдореЗрдВ Google Sheets API v4 рдХреЗ рд╕рд╛рде рдХреИрд╕реЗ рдХрд╛рдо рдХрд░рдирд╛ рд╣реИ googlesheets4
, рдпрд╛:
- рдПрдкреАрдЖрдИ рджреНрд╡рд╛рд░рд╛ Google рд╢реАрдЯ рдХреЗ рд╕рд╛рде рдХрд╛рдо рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рдХреИрд╕реЗ рдЕрдзрд┐рдХреГрдд рдХрд┐рдпрд╛ рдЬрд╛рдП;
- рдкреИрдХреЗрдЬ рдХреЗ рдореБрдЦреНрдп рдХрд╛рд░реНрдпреЛрдВ рдкрд░ рд╡рд┐рдЪрд╛рд░ рдХрд░реЗрдВ;
- рдЖрдЗрдП рдбреЗрдЯрд╛ рдкрдврд╝рдиреЗ, рдирдИ рддрд╛рд▓рд┐рдХрд╛ рдмрдирд╛рдиреЗ рдФрд░ рдПрдкреАрдЖрдИ рджреНрд╡рд╛рд░рд╛ Google рд╢реАрдЯ рдХреЗ рд╕рд╛рде рдЕрдиреНрдп рдЬреЛрдбрд╝рддреЛрдбрд╝ рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рдХреБрдЫ рдХреЛрдб рдЙрджрд╛рд╣рд░рдг рджреЗрдЦреЗрдВред
рдпрд╣ рдЖрд▓реЗрдЦ рдПрдХ рдЕрдкреНрд░рдЪрд▓рд┐рдд рдкреИрдХреЗрдЬ рдХреЗ рдЙрдкрдпреЛрдЧрдХрд░реНрддрд╛рдУрдВ рдХреЛ googlesheets
рдирдП рдореЗрдВ рдорд╛рдЗрдЧреНрд░реЗрдЯ рдХрд░рдиреЗ рдореЗрдВ рднреА рдорджрдж рдХрд░реЗрдЧрд╛ googlesheets4
ред
рдЙрди рд▓реЛрдЧреЛрдВ рдХреЗ рд▓рд┐рдП рдЬреЛ рд▓реЗрдЦ рдкрдврд╝рдиреЗ рдореЗрдВ рдмрд╣реБрдд рдЖрд▓рд╕реА рд╣реИрдВ, рдпрд╣рд╛рдВ 10 рдорд┐рдирдЯ рдХреЗ рд▓рд┐рдП рдПрдХ рд▓рд┐рдВрдХ рд╣реИ, YouTube рдкрд░ рд░реВрд╕реА-рднрд╛рд╖рд╛ рд╡реАрдбрд┐рдпреЛ рд╕рдмрдХред рдмрд┐рд▓реНрд▓реА рдХреЗ рдиреАрдЪреЗ рдмрд╛рдХреА рдХрд╛ рд╕реНрд╡рд╛рдЧрддред

рд╕рд╛рдордЧреНрд░реА
, R, telegram youtube . R.
- googlesheet4
- googlesheets googlesheets4
- googlesheets4
4.1.
4.2.
4.3.
4.4. - googlesheets4
- API Google R
6.1. Google
6.2. Google API
6.3. Google
6.4.
6.5. Google Google
googlesheet4
R, Google Sheets API googlesheet
. , тАФ " googlesheets4 ?".
, googlesheets
, Google Sheets API V3. Google , 3 API 3 2020 .

, googlesheets
, 3 googlesheets4
, .
googlesheets googlesheets4
googlesheets
googlesheets4
.
googlesheets4
API Google , , googlesheets4
, RStudio.
, dev GitHub.
# devtools
if ( !require(devtools) ) install.packages("devtools")
# googlesheets4
devtools::install_github("tidyverse/googlesheets4")
#
library(googlesheets4)
googlesheets4
3 :
gs4_auth()
.- .
- .
gs4_auth()
.
, , 90% . , .
Gogle Cloud, .
?
:
- Google Cloud Console , . .
- ┬л ┬╗ > ┬лAPI ┬╗ > ┬л ┬╗.
- ┬л ┬╗ > ┬л OAuth┬╗.
- .
- id secret .
- JSON , id .
JSON

ID

Google Console, " OAuth", email, .

, Google Sheets API, API.

RStudio, .
JSON :
#
library(googlesheets4)
# JSON ,
gs4_auth_configure(path = "C:/path/to/app_credential.json")
#
gs4_auth(email = "your_email@gmail.com")
ID :
#
library(googlesheets4)
# JSON ,
httr::oauth_app(appname = "app_name",
key = "00000000-abcdefghk.apps.googleusercontent.com",
secret = "qwertyuiopasdf")
#
gs4_auth(email = "your_email@gmail.com")
gs4_auth()
, , . RStudio .
, :
- Google Cloud, .
- Google Sheets API, .
- .
- ( ) "".

- , "".
- " " > JSON > .
- JSON , .
- "".
, .

Google . , .
- Google .
- " ".
- .
:
#
library(googlesheets4)
#
gs4_auth(path = "C:/path/to/service_credential.json")
, , Google , API.
:
- .
- Google . Google .
. , - JSON , .
googlesheets4
googlesheets4.
gs4_auth()
тАФ ;as_sheets_id()
тАФ Google , URL Google ;range_read()
тАФ Google ;gs4_create()
тАФ Google ;sheets_write()
тАФ Google , . ;sheets_append()
тАФ ;sheet_add()
тАФ Google ;sheet_delete()
тАФ Google ;sheet_names()
тАФ Google ;sheets_browse()
тАФ Google .
, Google .
API Google R
Google .

- . Google R iris
, mtcars
ToothGrowth
.
Google
Google .
, , .
as_sheet_id()
, URL Google .
URL: https://docs.google.com/spreadsheets/d/1hP1OwJuSHfvrTZvZUgEHDwcPPVlDMwPwCqCQPs64OSE/
: 1hP1OwJuSHfvrTZvZUgEHDwcPPVlDMwPwCqCQPs64OSE
URL , /d/
.
googlesheets4
range_read()
.
Google
#
library(googlesheets4)
#
gs4_auth(email = "your_mail@gmail.com")
#
my_dox <- as_sheets_id("1hP1OwJuSHfvrTZvZUgEHDwcPPVlDMwPwCqCQPs64OSE")
# test_data
data <- range_read(my_dox, sheet = "test_data")
.
data <- as_sheets_id("1hP1OwJuSHfvrTZvZUgEHDwcPPVlDMwPwCqCQPs64OSE") %>%
range_read("test_data")
Google API
gs4_create()
.
- name тАФ Google ;
- locale тАФ ;
- timeZone тАФ ;
- sheets тАФ , , , .
Google
#
library(googlesheets4)
#
gs4_auth(email = "your_email@gmail.com")
# Google
ss <- gs4_create(name = "my_new_dox",
locale = "ru_RU",
sheets = list(mtcars = mtcars,
iris = head(iris)))
#
sheets_browse(ss)
Google "my_new_dox", 2 : mtcars, iris.
Google
, Google , , ss
.
, .
#
sheets_write(ToothGrowth, ss,
sheet = "tooth_growth")
Writing to 'my_new_dox'
Writing to sheet "tooth_growth"
sheets_write()
3 :
- data тАФ , .
- ss тАФ Google ,
as_sheets_id()
gs4_create()
. - sheet тАФ Google , .
тАФ .
sheets_append()
, 3, .
- data тАФ .
- ss тАФ Google ,
as_sheets_id()
gs4_create()
. - sheet тАФ .
my_new_dox iris 6 , .
# iris
sheets_append(data = iris[7:150,], ss,
sheet = "iris")
Writing to 'my_new_dox'
Appending 144 row(s) to 'iris'
Google Google
, googlesheets4
googledrive
.
googledrive
install.packages("googledrive")
Google drive_mv()
. drive_auth()
.
googledrive
, .. gargle
. drive_auth()
googlesheets4
: gs4_auth(token = drive_token())
.
Google URL . drive_mkdir()
.
as_id()
.
Google Google
#
library(googlesheets4)
library(googledrive)
#
## ,
## gs4_auth(email = "your_email@gmail.com")
## drive_auth(email = "your_email@gmail.com")
## google drive, google sheets
drive_auth(email = "your_email@gmail.com")
gs4_auth(token = drive_token())
#
##
ss <- as_sheets_id("1BNrYUajVSR3wuGySY0ybXrqH3-Jjq-eIS5_f_a6kt_c")
## Google
folder <- as_id("1x94xChfZwSCPFzHvWqwk6HyF85_ASDFW")
#
## folder <- drive_mkdir("my_folder")
# Google
drive_mv(file = ss,
path = folder)
File moved:
* my_new_dox -> my_folder/my_new_dox
:
googlesheets4
, Google Sheets API.
googlesheets4
. 2020 , .
, , R . , youtube , R.