Showing posts with label Convert CSV file to Excel file in Ax 2012. Show all posts
Showing posts with label Convert CSV file to Excel file in Ax 2012. Show all posts

Monday, 4 June 2018

Convert CSV file to Excel file in Ax 2012

static void CsvFileToExcell(Args _args)
{
#Excel
      SysExcelApplication excel;
      SysExcelWorkBooks books;
      Filename excelFileName;
      Filename csvFileName;
      ;
      csvFileName = 'D:\\csv.txt';
      excelFileName = ' D:\\csvtoexcell.xls';
      excel = SysExcelApplication ::construct( );
      excel.displayAlerts (false);
      books = excel.workbooks( );
      books.open(csvFileName,0,false,2,"","",false,#xlWindows,",",false,false,1,false,false,1,false);

      books.item(1).saveAs(excelFileName);
      excel.quit() ;
}