data grid code

Sadhu Nadesan sadhu at
Tue Apr 7 15:02:36 EDT 2009

Ok!  Well you probably aren't that interested but I'm making progress.  
Here is the code for a button that loads the data, so the first part of 
the construction is accomplished.  Any suggestions on improvement of 
course welcome.  by the way, I noticed a typo in the docs, page 40, it says

If you set the uText dgText of a data grid table then the data is 
treated as tab delimited text.

the "uText" should be removed.

on mouseUp
   --Retreive the Excel CSV (quote and comma delimited) file
   answer file "The spread sheet file name?"
   put it into theExcelFile
   open file theExcelFile for read
   read from file theExcelFile until EOF
   put it into gTheData
   close file theExcelFile
   --   Convert the CSV data to tab delimited
   put quote & comma & quote into csvPattern
   replace csvPattern with tab in gTheData
   replace quote with empty in gTheData
   --   Leave out the column headers since they are part of the data grid
   delete line 1 of gTheData
   set the dgText of group "Data Grid 1" to gTheData
end mouseUp

More information about the use-livecode mailing list