Save points generated by Grasshopper as txt/excel format

Hi all,
I am trying to save the points (up to 10000 points or more) generated by Grasshopper to server and read them in another script later.

I tried using lunchbox but the process takes a long time even for merely 4 points.

Is there a better way to write these points/mesh to a txt file that takes faster?
maybe a way to do it in C# using RhinoCommons API?

If you only need to read/write the data in grasshopper, the native Data Output and Data Input components work very well.


I am using a VB Script that I got from somewhere on this forum for ages now and have built myself a user object that contains things I usually need. I have used it regularly for large datasets in a similar size (around 10.000 lines of csv)

You can input any text, select a folder from a dialog, enter a filename, file ending and then save the file.

It has worked well for me for the last few years. (11.9 KB)

ps: the C# script is so it “remembers” the Folder location that you picked even after restart. Plus there is also a boolean input to append data, but I have never needed that.

1 Like

It runs way faster than the lunchbox plugin. literally took no time at all.

But how can we read the exported csv file?

Do you mean how to read the CSV file again in Grasshopper?

There is a read file component that outputs the lines. You then graft the lines, then do a Text Split using whatever your separator was. Then normally you would do a Flip matrix and then explode tree. That way you end up with however many columns you had as lists. Sorry, not on my PC right now, but hope that makes sense.

ps: the read file component has a known bug, where it is super slow if you are reading from a file server. But you can also build a super simple file reader using a VB, C# or Python component.

yes. For those who also wonder how to build a read CSV scfipt. Here is the C# code:

        if (iRead)
            string line;
            StreamReader reader = new StreamReader(iFilePath);
            while ((line = reader.ReadLine())!= null)

It seems like the code is only for reading the lines, but not for actually getting the data out of the CSV, right?

Here is the example I was explaining above. Of course there is always some manual adjustments needed according to your specific CSV file. (28.6 KB)

ps: sample CSV data is from: CSV Files

1 Like