How to convert Excel to csv

Hi shilpareddy,

- Simply make a copy of the existing 'Save Workbook As' action tab of the MS Excel VBO.
- Rename it as 'Save Workbook As CSV'
- Go to the Code stage and modify the below marked in bold
wb.SaveAs(filename,6)

6 is the numeric constant for xlCSV FileFormat.
- Publish your new action
- From the process when you pass the 'Filename' Input parameter pass it with the .csv extension
"c:\MyFileName.csv"
- After you run the process you will see the Input/Output as below
View attachment 716
Hello VJR,

I tried the above approach.
this method works perfectly fine on debug mode, when tried to run the code in full speed mode /or via control room.
I get an error stating :

Internal : Could not execute code stage because exception thrown by code stage: SaveAs method of Workbook class failed .
I even tried to increase the timeout in the code to 90 seconds and still no luck.
Please see the attached and advise .

Please let me know what is missing .

Thanks
Sanjay
 

Attachments

  • Save As error.pdf
    242.9 KB · Views: 5

zdravko7

New Member
Hi shilpareddy,

- Simply make a copy of the existing 'Save Workbook As' action tab of the MS Excel VBO.
- Rename it as 'Save Workbook As CSV'
- Go to the Code stage and modify the below marked in bold
wb.SaveAs(filename,6)

6 is the numeric constant for xlCSV FileFormat.
- Publish your new action
- From the process when you pass the 'Filename' Input parameter pass it with the .csv extension
"c:\MyFileName.csv"
- After you run the process you will see the Input/Output as below
View attachment 716
Hey guys,

I tried this solution and it successfully created the CSV file.

However, one of the columns I am using has a large number (16 digits) and when Blue Prism converts it to CSV with this method it somehow makes it into a number and rounds it up. So when I read the CSV with the "Get CSV Text as Collection" action in File Management the number is now different.

(e.g. Original number is 8123854381238, the end result of the read is 8123854381240).

Steps to reproduce.

1. Make an Excel file .xls (this is what the system I am automating gives me, it's not a .xlsx)
2. Put a large number in one of the columns
3. Use the save as fix above
4. Read the .csv file with the file management action
5. Compare the numbers BP has read with the original number (try with different numbers if you want, I am using 16-digit numbers)

Any ideas?
 
Top