forked from RVerse-Tutorials/GoogleDrive1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReadme.Rmd
More file actions
74 lines (53 loc) · 1.92 KB
/
Readme.Rmd
File metadata and controls
74 lines (53 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
title: "Basic Google Drive Interaction"
date: '`r format(Sys.time(), "%A %B %d %Y %X %Z")`'
output:
md_document:
toc: true
toc_depth: 3
html_document:
toc: true
toc_float: true
toc_depth: 3
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r include=FALSE}
options(
gargle_oauth_cache = ".secrets",
gargle_oauth_email = "eli.holmes@noaa.gov"
)
googledrive::drive_deauth()
googledrive::drive_auth(scopes = "https://www.googleapis.com/auth/drive.readonly", email="eli.holmes@noaa.gov")
```
# Overview
This tutorial will use 4 functions within the [{googledrive}](https://googledrive.tidyverse.org/) package:
* `drive_auth()` Authorize {googledrive} to access your Google Drive
* `drive_ls()` List contents of a folder or shared drive
* `drive_download()` Download a Drive file
* `drive_upload()` Upload a Drive file
This code is designed to be run locally (meaning on someone's computer manually). If the Google Drive folder is private, you need to run the authentication code first before you knit the Rmd file.
Below are examples using a NOAA Google Drive folder.
# Set-up
## 1. Install **googledrive** package (if needed)
```{r eval=FALSE}
install.packages("googledrive")
```
## 2. Create a folder on Google Drive (if needed)
I have created a Google Drive folder in my NOAA account. It is only viewable if you are in NOAA, and is only editable by the creator (Eli). It has the following sample files:

## 3. Copy the url to the Google Drive folder location*
*Only people with a NOAA email will be able to see this folder
```{r}
url_googledrive <- "https://drive.google.com/drive/folders/11WnXxs56jORbLkD1mFTZxwSaShex3Sse"
id_googledrive <- "11WnXxs56jORbLkD1mFTZxwSaShex3Sse"
```
```{r child="Download-files.md"}
```
```{r child="Upload-files.md"}
```
```{r child="Batch-word-to-rmd.md"}
```
```{r child="Authorizing.md"}
```