我正在制作一个闪亮的应用程序,该应用程序将复制Google调查表。我如何将其链接到Google电子表格,以便每次有人填写表格时,都会在Google云端硬盘的该特定工作表中添加新行。 到目前为止,这是我的进步。
library(shiny)
library(googlesheets)
fields <- c("Date Of Request (dd/mm/yyyy)", "Clinet Name",
"Brand/Category","Query (Brief)","Country/Region","Priority (H/M/L)","DBL
Team","Dependencies (DA,DS,GDDC..)","Owner(s) from Dependent Team",
"Completion date provided by Dependent Team","ETA Date to CS","Status
(In-Progress/Closed)","Actual Completion Date","Additional Notes")
#devtools::install_github('rstudio/DT')
shinyApp(
ui = fluidPage(
textInput("Date Of Request","Date Of Request (dd/mm/yyyy)","",width =
"100%"),
textInput("Clinet Name","Clinet Name","",width = "100%"),
textInput("Brand/Category","Brand/Category","",width = "100%"),
textInput("Query (Brief)","Query (Brief)","",width = "100%"),
textInput("Query From? (Client/CS)","Query From? (Client/CS)","",width =
"100%"),
textInput("Country/Region","Country/Region","",width = "100%"),
textInput("Priority (H/M/L)","Priority (H/M/L)","",width = "100%"),
textInput("DBL Team","DBL Team","",width = "100%"),
textInput("Dependencies (DA,DS,GDDC..)","Dependencies
(DA,DS,GDDC..)","",width = "100%"),
textInput("Owner(s) from Dependent Team","Owner(s) from Dependent
Team","",width = "100%"),
textInput("Completion date provided by Dependent Team","Completion date
provided by Dependent Team","",width = "100%"),
textInput("ETA Date to CS","ETA Date to CS","",width = "100%"),
textInput("Status (In-Progress/Closed)","Status (In-
Progress/Closed)","",width = "100%"),
textInput("Actual Completion Date","Actual Completion Date","",width =
"100%"),
textInput("Additional Notes","Additional Notes","",width = "100%"),
actionButton("submit", "Submit")
),
server = function(input, output, session) {
# Whenever a field is filled, aggregate all form data
formData <- reactive({
data <- sapply(fields, function(x) input[[x]])
data
})
library(googlesheets)
table <- "responses"
observeEvent(input$submit, {
saveData <- function(data) {
# Grab the Google Sheet
sheet <- gs_key("1rRw6YhTZ9WidkE1cUoFD1QODrS18QSn8OBMarcZeTO4")
# Add the data as a new row
gs_add_row(sheet,input = data)
}
})
}
)