OL Learn

Export to xlsx

Hi,

That is an excelent way to export to csv. I wonder if there is a similar way to export to xlsx (excel)?

I think it would be simpler if you converted the csv to xlsx in Workflow using the Run Script (VBScript) action:

The below example has no error management. So you can edit\modify as needed:

Dim Excel
Const xlDelimited = 1
Const xlWorkbookNormal = 51

Set Excel=CreateObject("Excel.Application")
Excel.Visible=False
Excel.DisplayAlerts=False
Excel.WorkBooks.OpenText "C:\Data\myCSV.csv", , , xlDelimited, , , , , True
Excel.ActiveWorkbook.SaveAs "C:\Data\myExcel.xlsx", xlWorkbookNormal
' see https://docs.microsoft.com/en-gb/office/vba/api/Excel.Workbook.SaveAs
Excel.ActiveWorkbook.Close False
Excel.Quit
Set Excel = Nothing

Thanks I’m going to try this!

I can’t really get it to work:

W3602 : Error 0 on line 5, column 1: Microsoft VBScript runtime error: ActiveX component can’t create object: 'Excel.Application’

Am I missing a plugin or something?

Microsoft Excel is probably missing on the machine you are testing this on.

That is an excel-lent point…