C# Class DSOffice.Excel

Show file Open project: DynamoDS/Dynamo Class Usage Examples

Public Methods

Method Description
ReadFromFile ( FileInfo file, string sheetName, bool readAsStrings = false ) : object[][]

Read data from a Microsoft Excel spreadsheet. Data is read by row and returned in a series of lists by row. Rows and columns are zero-indexed; for example, the value in cell A1 will appear in the data list at [0,0]. This node requires Microsoft Excel to be installed.

WriteToFile ( string filePath, string sheetName, int startRow, int startCol, object data, bool overWrite = false ) : object[][]

Write data to a Microsoft Excel spreadsheet. Data is written by row with sublists to be written in successive rows. Rows and columns are zero-indexed; for example, the value in the data list at [0,0] will be written to cell A1. Null values and empty lists are written to Excel as empty cells. This node requires Microsoft Excel to be installed.

Private Methods

Method Description
AddExcelWorksheetToWorkbook ( WorkBook workbook, string name ) : WorkSheet
GetDataFromExcelWorksheet ( WorkSheet worksheet ) : object[][]
GetExcelWorksheetByName ( WorkBook workbook, string name ) : WorkSheet
GetWorksheetsFromExcelWorkbook ( WorkBook workbook ) : DSOffice.WorkSheet[]
NewExcelWorkbook ( ) : WorkBook
Read ( string filePath, string sheetName ) : object[][]
ReadExcelFile ( FileInfo file ) : WorkBook
ReadExcelFile ( string file ) : WorkBook
SaveAsExcelWorkbook ( WorkBook workbook, string filename ) : WorkBook
WriteDataToExcelWorksheet ( WorkSheet worksheet, int startRow, int startColumn, object data = null ) : WorkSheet

Method Details

ReadFromFile() public static method

Read data from a Microsoft Excel spreadsheet. Data is read by row and returned in a series of lists by row. Rows and columns are zero-indexed; for example, the value in cell A1 will appear in the data list at [0,0]. This node requires Microsoft Excel to be installed.
public static ReadFromFile ( FileInfo file, string sheetName, bool readAsStrings = false ) : object[][]
file System.IO.FileInfo File representing the Microsoft Excel spreadsheet.
sheetName string Name of the worksheet containing the data.
readAsStrings bool toggle to switch between reading Excel file as strings only or not
return object[][]

WriteToFile() public static method

Write data to a Microsoft Excel spreadsheet. Data is written by row with sublists to be written in successive rows. Rows and columns are zero-indexed; for example, the value in the data list at [0,0] will be written to cell A1. Null values and empty lists are written to Excel as empty cells. This node requires Microsoft Excel to be installed.
public static WriteToFile ( string filePath, string sheetName, int startRow, int startCol, object data, bool overWrite = false ) : object[][]
filePath string File path to the Microsoft Excel spreadsheet.
sheetName string Name of the workseet to write data to.
startRow int Start row for writing data. Enter 0 for Row 1, 1 for Row 2, etc.
startCol int /// Start column for writing data. Enter 0 for Column A, 1 for Column B, etc. ///
data object Data to write to the spreadsheet.
overWrite bool
return object[][]