Grasshopper

algorithmic modeling for Rhino

I am trying to extract data from grasshopper to an excel sheet. (with automatic updates, but not with "stream content") (as the work flow its not ideal).

there are lots of tutorials and examples around about it. but i just can manage to make them work. apparently it is a bug from Microsoft own software... i am keep getting the same message.

script exception: old format or invalid type library. (exception from HRESULT: 0X80028018 (TYPE_E_INVDATAREAD))

I've check on the web for a solution and i've tried all the code i found but i still can get it working...

Any idea... does anyone out there had the same problem.

BTW. i have tried changing the lenguage in my office application and it does not work.

Views: 1084

Replies to This Discussion

It might be best to post some code, as that's not nearly enough to really say what's going on. I've gotten the Excel<->GH connection to work fine, although at the moment its somewhat antiquated. Check the following posts/video and see if they help

http://www.youtube.com/watch?v=7Cb4NuF2wcw
http://liquidtectonics.blogspot.com/search/label/Excel
cool,

you are right, without the code it is impossible.

i am actually using a definition made by Luis that includes some of your code. i have checked your video and your scripts... and i keep getting the same error. i am sending you the definition, excel, and the print screen.

thanks for you time...
Attachments:
hi damien / andres.m

below the vb.net text for a working linkage to an open excel file
(main part is from the old damien script)
its important that your windows is set on US

Dim xlApp As Object
' override language
Dim oldCI As System.Globalization.CultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture
System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("en-US")
'Grab a running instance of Excel
xlApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application")

Dim wb As Object = xlApp.Activeworkbook
Dim sheet As Object = wb.Activesheet

' Add a new workbook
'wb = xlApp.workbooks.add

' Declare a range object to hold our data
'Dim rng As Object

Dim i As Int32
For i = 1 To x.count
'rng = wb.Activesheet.Range("A1").Resize(10, 1)
'rng.value = x(i)
sheet.Cells(i, 1).Value = x(i - 1)
sheet.Cells(i, 2).Value = y(i - 1)
sheet.Cells(i, 3).Value = z(i - 1)
Next

System.Threading.Thread.CurrentThread.CurrentCulture = oldCI
Hi damien,

I am aware of the locale... i actually found this pice of code and tested... but probably my problem was that my windows is not fully set to us... i will try that now...

i appreciate the effort.

cheers...

andres.
I changed setting under the Regional and Language Options to English(US) and the code still does not work. The puzzling thing is yesterday it worked but today it does not.

Regards
Is there a way of importing values from a range of cells in an excel spreadsheet into grasshopper.

Regards
hi there,

if you follow this discussion, you might be able to understand this set of code.

this code comes from a definition developed by:

Definition by Luis E. Fraguada
Feb, 19, 2009
http://www.livearchitecture.net
email: code@livearchitecture.net

References:
Damien Alomar
http://liquidtectonics.blogspot.com/


this is the code... it is pretty much the same as writing on an excell sheet, instead of writing a value to a cell. you have to extract the value from it.

good luck

Dim oldCI As System.Globalization.CultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture
System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("en-US")

Dim xlApp As Object
Dim CellContents As New List(Of Object)
Dim i, j As Int32
Dim RowRange As Int32
Dim ColumnRange As Int32
ColumnRange = (EColumn - SColumn) + 1
RowRange = (ERow - SRow) + 1


'Grab a running instance of Excel
xlApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application")
For i = 0 To RowRange - 1
For j = 0 To ColumnRange - 1
CellContents.Add(xlApp.Worksheets(1).Cells(SRow + i, SColumn + j).Value)
Next
Next
A = CellContents
This code is damien's... I did a few other things in the def.
On my page I have a version I coded through Open Office (also reads and writes xls files). Www.livearchitecture.net
Thanks for this

Regards
Hi Andres

When I use the code that you posted, The A output parameter only seems to store the last cell value.

Many thanks
WT

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service