-
Notifications
You must be signed in to change notification settings - Fork 4
How to push data to Excel
When pushing data from Grasshopper to Excel the following process can be used.
From left to right:
A component called “BH.oM.Adapter.FileSettings.FileSettings() {String FileName, String Directory, String Name}” when searching with ctrl + shift + b. To this component you connect a panel with the name of the Excel file you wan to push the objects to and a panel with the directory to where said file is saved.
Next step is creating an Excel adapter. Do this by using the CreateAdapter component found in the BHoM tab. Right click on the adapter and in the search box type “excel” and choose the alternative that comes up.
Then create a new component called ExcelPushConfig by searching via ctrl + shift + b. There are two options when choosing this component, in this tutorial we will be covering the simple way to push. So when searching choose the one starting with “BH.oM.Adapter.ExcelPushConfig.ExcelPushConfig(String sheetName, String…”
When pushing objects to Excel it automatically creates a new worksheet, put what you want to call that worksheet in a panel and connect it to “sheetName”. If no name is given it will create a sheet with the default name “BHoM_Export_...”. OBS: If the name you choose is the same as an already existing worksheet in the Excel file then that worksheet will be replaced and the data will be overwritten with the newly pushed objects. In the second panel put whatever cell you want the new objects to start filling in from and connect it to “startingCell”
Lastly create a Push component found in the BHoM tab and connect the ExcelAdapter to “adapter”, ExcelPushConfig to “actionConfig”, a BooleanToggle to “active” and the objects you want to push connects to “objects”.
Note that Excel needs to be closed for the push to be successful.
If the worksheet name that you have given in grasshopper is the same as an already existing worksheet in the specified file, then that worksheet will be replaced and overwritten by the one you create when pushing.