Error in fetching records from csv file(shiny apps)

Hi guys,
I am calculating the daily returns on the stocks, In that, I am taking the start date and end date from the user(UI).

I dont want to read whole CSV file. So I used Read read.csv.sql with sql query to import csv in reactive . but its giving " Error in append(file.format, list(eol = eol)) : object 'input' not found"

if someone knows how to solve this issue, please let me know. Thank you.

Datafile;
head()

Date axp wfc. amzn
|2016-01-04|67.59|52.91|636.99|
|2016-01-05|66.55|52.89|633.79|
|2016-01-06|64.42|51.88|632.65|
|2016-01-07|63.84|50.4 |607.94|
2016-01-08|63.63|49.56 |607.05|

code:

library(shiny)
library(timeSeries)
library(caTools)
library(dplyr)
library(PerformanceAnalytics)
library(xts)
library(dygraphs)
library(sqldf)

ui <-fluidPage(

titlePanel("Daily Return"),
sidebarPanel(
dateRangeInput("daterange", "Date range:",start = "2018-01-01",end = Sys.Date(),min = "2017-01-01", max = Sys.Date(), format = "yy-mm-dd",
separator = " - ")),

mainPanel(
dygraphOutput("dygraph")
))

server <- function(input, output) {
dataInput <- reactive({
Data<- read.csv.sql("Trade_Data.csv", "select * from file WHERE Date >= ", input$daterange[1] ," AND Date <= " , input$daterange[2] , sep=",", header=T,
row.names=NULL)
Data <- xts(Data[,-1], order.by=as.Date(Data$Date,"%Y-%m-%d"))
portfolio_daily_Returns <- na.omit(ROC(Data, type="discrete"))
portfolio_daily_Returns <- as.timeSeries(portfolio_daily_Returns)
})

output$dygraph <- renderDygraph({
dygraph(portfolio_daily_Returns)

})

}

shinyApp(ui, server)

read.csv.sql() function does not concatenate text, you have to construct the sql query with a function like paste() and pass that as the sql parameter for the function, something like this:

query <- paste("select * from file WHERE Date >=", input$daterange[1] ,"AND Date <=" , input$daterange[2])
Data <- read.csv.sql("Trade_Data.csv", sql = query, sep=",", header=TRUE, row.names=NULL)