Fastest way to parse a spreadsheet into lists?

I have always read through the cells of a spreadsheet using a loop but now I am using some very long spreadsheets with many columns each requiring their own list.

Right now, for a 500 row spreadsheet this script takes 2 minutes to run. Is there a faster way?

thanks,


set firstNumber to display dialog "From which line number would you like to start?" default answer ""
set lastNumber to display dialog "On which line would you like to end?" default answer ""
set firstVim to text returned of firstNumber
set lastVim to text returned of lastNumber


--- Get Data From Excel
set {timeCode} to {{}}
set {theme1} to {{}}
set {theme2} to {{}}
set {theme3} to {{}}
set {theme4} to {{}}
set {theme5} to {{}}
set {timType} to {{}}
set {assetName} to {{}}
set {stimName} to {{}}
tell application "Microsoft Excel"
	repeat with r from firstVim to lastVim
		copy value of cell 1 of row r of active sheet as integer to the end of timeCode
		copy value of cell 6 of row r of active sheet to the end of theme1
		copy value of cell 7 of row r of active sheet to the end of theme2
		copy value of cell 8 of row r of active sheet to the end of theme3
		copy value of cell 9 of row r of active sheet to the end of theme4
		copy value of cell 10 of row r of active sheet to the end of theme5
		copy value of cell 2 of row r of active sheet to the end of stimName
		copy value of cell 3 of row r of active sheet to the end of timType
		copy value of cell 4 of row r of active sheet to the end of assetName
	end repeat
end tell



display dialog "INPUT COMPLETE"

Suggestion… refer to the cells as a group instead of individually, select the range in Excel, remove the start/stop dialog, then just

tell application "Microsoft Excel"
set timeCode to value of cells of column 1 of the selection
-- ... and so on for each column...
end tell

Hi there,

This is what I’ve been using, not sure if it’s any quicker.

tell application "Microsoft Excel"

	set startRow to 1
	set endRow to 50

	set theList to value of range ("B" & startRow & ":B" & endRow)

end tell

Regards,

Nick