R-tude: Read OneDrive Excel files
Created: 2019-09-20
; Updated: 2019-09-20
From https://onedrive.com, right click on the file and click “Download”.
In Brave (or Chrome), hit Shift-Command-J
to open the downloads page.
That’s your URL. Read it into an R data frame like this:
library(readxl)
url <- "https://ikl9pg.sn.files.1drv.com/y4mu_0J_zDuyU56LBAPlT4-ASQWsN3SqQ9OobV_8w0cFyy3XZCStCeGBxfCjzx9I2uVzQDrIfUG0p6m4eOe9vzzOMlamV3mccjstEYFXVo78bRvwW0k1nRVIJEkmN60rCSpya41L6IMcrZ4YhXWzFXS9w/Richard_Sprague_Tracking.xlsx?download&psid=1"
destfile <- "Richard_Sprague_Tracking.xlsx"
curl::curl_download(url, destfile)
Richard_Sprague_Tracking <- read_excel(destfile)
head(Richard_Sprague_Tracking)
## # A tibble: 6 x 25
## Date Z Geo Alcohol Coffee CBD Comment Bonding
## <dttm> <dbl> <chr> <dbl> <dbl> <dbl> <chr> <dbl>
## 1 2019-01-01 00:00:00 0 Merc… 1 NA NA <NA> 0
## 2 2019-01-02 00:00:00 0 Merc… NA NA NA <NA> 0
## 3 2019-01-03 00:00:00 0 Merc… NA NA NA <NA> 0
## 4 2019-01-04 00:00:00 0 Merc… 2 NA NA <NA> 0
## 5 2019-01-05 00:00:00 0 Merc… 0 NA NA <NA> 0
## 6 2019-01-06 00:00:00 0 Merc… NA NA NA <NA> 1
## # … with 17 more variables: Bedtime <dttm>, Risetime <dttm>,
## # Awaketime <dbl>, SleepNotes <chr>, Food <chr>, Terbinafine <dbl>,
## # Kefir <dbl>, Whittaker <dbl>, Multivitamin <dbl>, Prostate <lgl>,
## # Magnesium <dbl>, `Vitamin D (K IU)` <dbl>, BP <lgl>, Statin <lgl>,
## # `Fish Oil` <dbl>, ptile <lgl>, pcnt.wrong <lgl>
That’s it!
Unfortunately this apparently works only temporarily. When I try reading again from the same URL a few days later, I get a 404 error.