PDA

View Full Version : importing data from excel


ungoliath
04-08-2009, 07:08 PM
This is code I copied from another thread except that I replaced .dat w/ .csv

in_name = "C:\test.dat"
in_file = openfile in_name
with animate on
(
while not eof in_file do
(
slidertime = slidertime + 5 -- need to account for time values somehow: could also read in
x = readvalue in_file
y = readvalue in_file
z = readvalue in_file
skiptonextline in_file
$box01.position = point3 x y z
)
)

These are the errors that I get

No ""eof"" function for undefined <<
for "C: est.csv"

Then I took out the eof bits and got
No ""readValue"" function for undefined

I'm extremely new to maxscript and pretty sure there's some minor detail I'm missing. Can anyone shed some light on what's up w/ that?

ungoliath
04-10-2009, 11:47 AM
To anyone reading this someone told me that in the line c:\test.csv

I need c:\\test.csv because apparently \t does something else.

JHN
04-10-2009, 01:09 PM
\t stands for a tab character in a string.
You can also use:
@"c:\test.dat"

With @ you don't need to escape characters in a path string.

-Johan

ungoliath
04-10-2009, 03:08 PM
Cool Thanks

CGTalk Moderation
04-10-2009, 03:08 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.