GetWorksheetByName() private method

instance method, (GetExcelWorksheetByName node)
private GetWorksheetByName ( string sheetName ) : WorkSheet
sheetName string
return WorkSheet
Ejemplo n.º 1
0
        /// <summary>
        ///     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.
        /// </summary>
        /// <param name="file">File representing the Microsoft Excel spreadsheet.</param>
        /// <param name="sheetName">Name of the worksheet containing the data.</param>
        /// <returns name="data">Rows of data from the Excel worksheet.</returns>
        /// <search>office,excel,spreadsheet</search>
        public static object[][] ReadFromFile(FileInfo file, string sheetName)
        {
            WorkBook  wb = WorkBook.ReadExcelFile(file.FullName);
            WorkSheet ws = wb.GetWorksheetByName(sheetName);

            return(ws.Data);
        }
Ejemplo n.º 2
0
        public static object[][] ReadFromFile(FileInfo file, string sheetName, bool readAsStrings = false, bool showExcel = true)
        {
            object[][] data;

            if (!showExcel)
            {
                ExcelInterop.ShowOnStartup = false;
            }
            WorkBook  wb = WorkBook.ReadExcelFile(file.FullName);
            WorkSheet ws = wb.GetWorksheetByName(sheetName);

            if (readAsStrings)
            {
                data = ws.GetData(true);
            }
            else
            {
                data = ws.Data;
            }
            if (!showExcel)
            {
                wb.CloseHidden();
                ExcelInterop.ShowOnStartup = true;
            }

            return(data);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     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.
        /// </summary>
        /// <param name="filePath">File path to the Microsoft Excel spreadsheet.</param>
        /// <param name="sheetName">Name of the worksheet containing the data.</param>
        /// <returns name="data">Rows of data from the Excel worksheet.</returns>
        /// <search>office,excel,spreadsheet</search>
        public static object[][] Read(string filePath, string sheetName)
        {
            WorkBook  wb = WorkBook.ReadExcelFile(filePath);
            WorkSheet ws = wb.GetWorksheetByName(sheetName);

            return(ws.Data);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     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.
        /// </summary>
        /// <param name="file">File representing the Microsoft Excel spreadsheet.</param>
        /// <param name="sheetName">Name of the worksheet containing the data.</param>
        /// <param name="readAsStrings">toggle to switch between reading Excel file as strings only or not</param>
        /// <returns name="data">Rows of data from the Excel worksheet.</returns>
        /// <search>office,excel,spreadsheet,ifequalreturnindex</search>
        public static object[][] ReadFromFile(FileInfo file, string sheetName, bool readAsStrings = false)
        {
            WorkBook  wb = WorkBook.ReadExcelFile(file.FullName);
            WorkSheet ws = wb.GetWorksheetByName(sheetName);

            if (readAsStrings)
            {
                return(ws.GetData(true));
            }

            return(ws.Data);
        }
Ejemplo n.º 5
0
 public static WorkSheet GetExcelWorksheetByName(WorkBook workbook, string name)
 {
     return(workbook.GetWorksheetByName(name));
 }
Ejemplo n.º 6
0
 public static WorkSheet GetExcelWorksheetByName(WorkBook workbook, string name)
 {
     return workbook.GetWorksheetByName(name);
 }