Notifications
Clear all

[Closed] data base reading

Hi all

I wondered if anyone knew how to get information from an excel spreadsheet into max

regards

Nebille

12 Replies

Hi Nebille,

Firstly you would export your excelsheet as a CSV text file, and then write a simple maxscript importer. There are plenty of these on www.scriptspot.com

It might help if you could provide a sample piece of data, or tell us a little more about it. Look on scriptspot and see how they use commands like:

fileopen
redelimiteredstring
readline
skiptostring

plus plenty of others. Also, read in the MXS help under filestream values.

Hi J

I have lots of coordinates ie X Y Z in an excel spread sheet and want to be able to extract this info to place objects in the scene according to the cords in excel. I geuss i just need to know how to get the info from each cell in excel

regards

Nebille

I geuss i just need to know how to get the info from each cell in excel

jman just told you. instead of saving as xls, save as csv…you can continue to edit your data using excel in this form. you can also very easily read the data by parsing with max script…if you want the the data at [row=2, col=3] then get the second line after the 3rd comma

Cheers guys, i will research this more to get a better understanding of what is happening,

regards

Nebille

Guys i have just written the script, thanks for the direction. I have a little problem that i hope you can help me with. At the moment i have to count how many lines are in the outputed .csv file and enter the number manually for the loop to get all the info. Ideally i would like to be able to say something like file.lines.count to find out how many lines are in the file.

Is this possible

regards

Nebille

do something like:

while not eof myfile do
(

)

<allonym>

works a treat, thanks for all the help people it makes forums like this a pleasure to use

regards

nebille

Hi nebille,

I tihnk you’re going down the wrong path.

Try something like:


f=openfile "mayfile.txt"
while not eof f do
(
x=readelimitedstring f ","
print x
)
close f

Thanks J

I will investigate your code today. All things are working fine within the script that i have written. Is there any reason why i should use the readlimited method over the eof loop.

regards

Nebille

Page 1 / 2