Importing/exporting data to Excel

Hi all,

I'm doing my first steps with Generative Components and wanted to import a list of data from Excel to be then recognized as an input for a GC node.

I found a similar question in the forum from some years ago where the answer was this: 

"Yes, this is possible. In order to gain access to the Excel Range node which supports reading from and writing to Excel workbooks and sheets, load the Bentley.GenerativeComponents.Office.dll from a path like C:\Program Files (x86)\<Bentley xx.xx.xx.xxx\GenerativeComponents\assemblies\ by using the Utilities > Manage Node Types > Loaded Assemblies dialog. "

I've looked for the "Bentley.GenerativeComponents.Office.dll" file within the indicated path but didn't find it, the .dll files that are stored in this path are shown in the image:

Is there a solution for this issue? Should I load a different .dll file to allow GC-Excel conexion?

Suggestions would be greatfully accepted.

Regards,

Aitana

  • Hello Aitana,

    In AECOsim Building Designer with GenerativeComponents CONNECT Edition, we have included the ExcelRange node type by default. It still requires Microsoft Excel to be installed on the machine on which the ExcelRange node resides; however, it does no longer require loading the DLL that you mention. 

    You should see the ExcelRange in the Utilities category of the Node Types Palette.

    A description of how to use the ExcelRange is part of the GC Teamwork SIG from February this year, available through the GenerativeComponents SIG learning path on the Bentley LEARNserver.

    HTH,

         Volker

       

  • Hello Volker,

    Thank you for your prompt reply. I've been watching Excel demo part from the SIG session recordings, but I've got some doubts about the script which defines the Excel address (RangeAddress = "R1C1:R"+(NumberOfBaysVertical+1)+"C"+(NumberOfBaysHorizontal+1). 

    Could you explain me how does GC gets the info from Excel columns and rows?

    In the other hand, I still get an error on loading some kind of file which ends in a non-functioning GC node. I have no idea how to solve this, do you know what could it refers to? (error prompt in image is in spanish)

    Thank you

    Regards,

    Aitana

  • Hello Aitana,

    When reading from an Excel sheet, there are several conditions that need to be met:

    • Microsoft Excel is installed on the computer (preferably a recent version). From the error message it seems that something is amiss here because apparently some Microsoft library cannot be found. If Excel is installed, try to "repair" the installation and run Microsoft Windows Updates.  Otherwise, do install Microsoft Excel. 
    • A workbook has been created with a sheet that contains the data that need to be read.
    • This has been saved to disk.
    • The file path and name is identified to the ExcelRange node.  This is a string, so it needs to be in quotes. 
    • The sheet is identified to the ExcelRange node.  This is also a string, in quotes, and needs to match accurately the sheet name on which the data reside.

    If all these conditions are met, there shouldn't be a problem reading the data.  Have you downloaded and run the corresponding script from the SIG session? 

    In the script example, we have been using the R1C1 type notation for the range specification.  R stands for row, C for column, the numbers specify which row and which column.  R1C1 would be the starting cell and RNCM would be the diagonally opposed end cell that spans the rectangular array of data to be read (with N and M whole numbers). 

    In the example we specify the end cell dynamically based on which data range we need to read to fill the parameter input into which we feed the read data. We do that by string arithmetic, composing or concatenating the string from string variables (e.g. "R1C1:R") and integer values (e.g. NumberOfBaysVertical+1).  Let's say NumberOfBaysVertical is equal to 6 and NumberOfBaysHorizontal is equal to 11, then the fully composited string for the expression

    "R1C1:R"+(NumberOfBaysVertical+1)+"C"+(NumberOfBaysHorizontal+1

    is

    "R1C1:R7C12"

    HTH,

         Volker