Vous êtes sur la page 1sur 1

Once you have information in Dynamo, you can export it to Microsoft Excel.

This can be very


beneficial when working with lists.In this exercise, four points have been created, and those points
have also been input into two lists. The lists can be used to create lines between those points. You
can also export a list of points to Excel. The process is very simple; you just need to understand the
information needed. First of all, you need an existing Excel file to write to. To begin the process, you
need to place the Excel.WriteToFile node. You can find this node in the node Library under the
Office category. Expand Office > Excel and then click WriteToFile. When you do, the
Excel.WriteToFile node is placed on the canvas. Move the node to the right of the graph. This node
has six inputs: filePath, sheetName, startRow, startCol, data, and overWrite. You can use the File
Path node to input the filePath. In the node Library, search for "file path" and then click File Path in
the list to place the File Path node on the canvas. With the File Path node, you can click Browse to
open an Open dialog, navigate to the folder where the Excel file is saved, select it, and then click
Open. In the exercise files, there is a blank Excel file. Navigate to the folder where the exercise files
are saved, select DynamoExport.xlsx, and click Open.Next, connect the output port of the File Path
node to the filePath input port. For the sheetName input, you need to indicate the name of the sheet
in the Excel file. You can do this with a String node. String nodes are great for inputting text
information. Search "string" in the node Library and then click String in the list to place a String
node. Enter "Sheet1", which is the default sheet name for the first sheet in an Excel file. Then
connect the output port of the String node to the sheetName input port. The startRow and startCol
input ports need a number to indicate which row and which column to start writing the data to. You
can use a Number node for this. Once again, you can search the node Library to quickly find the
node. Search "number" and then click Number to place a Number node. In Excel, the rows are
indicated with a number starting at 1, and the columns are indicated with a letter starting at
A. However, Dynamo does not read the information like this. Just like with lists, Dynamo needs the
programming language for the row and column. For that reason, you must enter the index
number. The first row is index 0 and the first column is index 0. With 0 entered in the Number node,
connect the output to both the startRow and startCol inputs. Next, you need the data. This can really
be any output information from Dynamo. For this example, export a single list of points. Connect the
output of the List.Create node to the data input.Lastly, you can choose whether or not to overwrite
any information in the specified Excel file. The default value is false, but you can use a Boolean
node to change it to true. For now, leave it as it is, and then click Run. Once you do, the information
is exported to the specified Excel file, on the specified sheet, and starting at the row and column you
entered. The Excel file is also opened so you can see the results.

Vous aimerez peut-être aussi