You can fix this with:
import excel "`=fullpath'", sheet("`=sheet'") cellrange("`=xlrange'") firstrow
I also think you don't need the front slash the fullpath definition.
Question
I'm trying to automate excel import into Stata. Here's my nonworking example. The error suggests to me that Stata is not evaluating the program argument as a scalar. How do I fix it?
scalar path = "C:\foo\data\"
scalar filename = "CompanyScores.xls"
scalar xlrange = "B3:AO149"
scalar sheet = "2012-2013 Scores"
scalar fullpath = path+"/"+filename
import excel fullpath, sheet(sheet) cellrange(xlrange) firstrow
Solution
You can fix this with:
import excel "`=fullpath'", sheet("`=sheet'") cellrange("`=xlrange'") firstrow
I also think you don't need the front slash the fullpath definition.