Importing CSV into DataGrid
Posted: Mon Dec 31, 2012 8:45 pm
I am importing a csv into a datagrid. For testing I used
It worked perfect. Now I want to hard code the data location to a file located in the "/Data/info.csv" It will always be located in a sub-directory of the application
I have tried using the same convention as video or photos paths - But nothing worked
put URL ("file:/Data/info.csv") into tFileContents
put URL ("file:Data/info.csv") into tFileContents
I know this is simple but it is driving me crazy...Help
Code: Select all
on ReadDataFile
answer file "Select a file"
put URL ("file:" & it ) into tFileContents
Put tFileContents into field "text" on Card "Database"
put line 1 of tFileContents into tColumnTitles ## Creates Columns from the contents of the CSV's first line
replace comma with return in tColumnTitles
set the dgProp["columns"] of group "AppData" on Card "Database" to tColumnTitles
delete line 1 of tFileContents
replace "," with tab in tFileContents
Put tFileContents into field "text" on Card "Database"
set the dgText of group "AppData" on Card "Database" to tFileContents
end ReadDataFileI have tried using the same convention as video or photos paths - But nothing worked
put URL ("file:/Data/info.csv") into tFileContents
put URL ("file:Data/info.csv") into tFileContents
I know this is simple but it is driving me crazy...Help