Hello All,
Is there an API that converts EXCEL to CSV using Infragistics. I have bunch of excel files stored in a database we need to convert them into csv for further processing . No GUI it is all background processing.
Please help or advise.
Regards
SK
Solution: Thanks every one for helping me and i have a solution below which is tested and integrated.
---------------------------------
'MIN/MAX Values used to frame the working size of the Excel data to be imported. Dim minCellRow As Integer = Int32.MaxValue Dim maxCellRow As Integer = Int32.MinValue Dim minCellColumn As Integer = Int32.MaxValue Dim maxCellColumn As Integer = Int32.MinValue
Dim internalWorkBook As Infragistics.Excel.Workbook = Infragistics.Excel.Workbook.Load(strExcelFile)
For Each row As Infragistics.Excel.WorksheetRow In internalWorkBook.Worksheets(0).Rows For Each cell As Infragistics.Excel.WorksheetCell In row.Cells If cell.Value IsNot Nothing Then 'Logic For Determining the Range of Rows/Columns in the Excel File. minCellRow = Math.Min(minCellRow, cell.RowIndex) maxCellRow = Math.Max(maxCellRow, cell.RowIndex) minCellColumn = Math.Min(minCellColumn, cell.ColumnIndex) maxCellColumn = Math.Max(maxCellColumn, cell.ColumnIndex) End If Next Next
Dim strData As StringBuilder = New StringBuilder() Dim strRow As StringBuilder
For rowIndex As Integer = minCellRow To maxCellRow
strRow = New StringBuilder()
'Loop through the columns and associate the value to each cell For columnIndex As Integer = minCellColumn To maxCellColumn strRow.Append(internalWorkBook.Worksheets(0).Rows(rowIndex).Cells(columnIndex).Value) If columnIndex < maxCellColumn Then strRow.Append(",") Next
If Not GlobalFunctions.IsNullorEmpty(strRow.ToString) Then strData.AppendLine(strRow.ToString()) strRow = Nothing
Next
If Not GlobalFunctions.IsNullorEmpty(strData.ToString) Then Return strData.ToString() End If
---------------
You can use the import method off of the Excel API to read in your Excel files, but there is not export to CSV format, that you will have to do it your self.
Here is an example that shows how load method works.
Taz.