如何直接读取(或写入)位于Google Drive中的“.csv”文件而无需下载?

问题描述 投票:0回答:1

最近喜欢数据挖掘。 (对于我这个年纪来说有点困难,但我仍然喜欢它!) 我不仅在工作期间这样做,而且在家里也这样做。

但是,我想知道是否有办法同步我的工作进度。

问题如下:

  1. 如何直接从谷歌驱动器读取“.csv”文件而无需下载,以及
  2. 如何将“.csv”文件直接写入Google Drive?

我想应该有某种代码或包来做到这一点。 如果有人分享他们在不同计算机之间同步工作进度(尤其是文件和 R 代码)的方法,那就太好了。

我希望这个问题不是太基本而无法提出。

r synchronization
1个回答
0
投票

解决此问题的一种通用方法,可以使用以下代码:

library(googlesheets4)

# For read data

data <- gsheet2tbl("https://docs.google.com/spreadsheets/.... rest of the link...")

# For write data

data <- write_sheet(
    ss = gs4_get(
      "https://docs.google.com/spreadsheets/.... rest of the link..."), # Here you need to copy the link of the sheet where you want to add the data from R
    sheet = "write the name of your sheet"
  )
© www.soinside.com 2019 - 2024. All rights reserved.