Reading Excel Points

Reading Excel Points

ahmadkhalaf7892
Advocate Advocate
347 Views
5 Replies
Message 1 of 6

Reading Excel Points

ahmadkhalaf7892
Advocate
Advocate

Points.PNG

Hi Everyone, is there any way I can read the points from an excel file ? For example here you can see that we have a set of XY Points, like in the Photo, P0 would have the coordinates of (76,-145,0), P1 would have the coordinates of (66,127,0)..., Is there any way I can read them?
Also can we create a model line from P0 to P1, then from P1 to P2, etc..., I'd appreciate any help 
Thanks

0 Likes
348 Views
5 Replies
Replies (5)
Message 2 of 6

moturi.magati.george
Autodesk
Autodesk

Hi @ahmadkhalaf7892,

 

If I understood your question correctly, you want to know if you can read data from an MS Excel file. If that is the case, I believe you can achieve what you want by using c# or python languages. After reading the data in the worksheet, you can then pass it to the Revit API. There are several examples on how to do that and I will share a few on how to read excel files in c#:

 

https://stackoverflow.com/questions/9155642/how-to-read-an-excel-file-in-c-sharp-without-using-micro...

 

https://www.c-sharpcorner.com/UploadFile/01a5f9/read-and-write-the-spreadsheet-without-any-dependenc...

 

https://csharp.hotexamples.com/examples/NPOI.XSSF.UserModel/XSSFWorkbook/-/php-xssfworkbook-class-ex...

 

Let me know if this works for you

  Moturi George,     Developer Advocacy and Support,  ADN Open
Message 3 of 6

jeremy_tammik
Alumni
Alumni

Also please note you you can vastly simplify your workflow by exporting from Excel to CSV format. The result is a simple comma-delimited text file that you can easily parse yourself in any language you like:

  

https://duckduckgo.com/?q=csv+parser

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 4 of 6

ahmadkhalaf7892
Advocate
Advocate
Hi @moturi.magati.george
Thanks a lot for your help , I'll check them now
0 Likes
Message 5 of 6

ahmadkhalaf7892
Advocate
Advocate
Hi Jeremy,
By that you mean I can read them using a normal text file not an excel sheet right ?
do you have any idea how I can create the points though? Thanks
0 Likes
Message 6 of 6

jeremy_tammik
Alumni
Alumni

In Excel, simply save as CSV.

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes