CSV from Excel Automation

navuser1
Member Posts: 1,334
Dear All,
A dataport is customized to create a csv file. After that a third party tool consumes this csv file for internal use.
Dataport has the following propertities .
1. FieldStartDelimiter =<">
2. FieldSeparator = |
As dataport is not acceptable in NAS environment & the client does not have xmlport executable permission in their license. So,
I have given a task to generate the same csv file without using any dataport/xmlport.
To do this I have created a Codeunit to generate the same csv file using Excel Automation in same database. I have checked the csv files generated from the codeunit is perfectly matching with the dataport generated csv file.
But the 3rd Party software is not accepting the codeunit generated csv files due to find inappropiate character in the files. :shock:
How does the 3rd Party Software see the codeunit generated files is given in an attachment files.
How to solve this type of issues ?
A dataport is customized to create a csv file. After that a third party tool consumes this csv file for internal use.
Dataport has the following propertities .
1. FieldStartDelimiter =<">
2. FieldSeparator = |
As dataport is not acceptable in NAS environment & the client does not have xmlport executable permission in their license. So,
I have given a task to generate the same csv file without using any dataport/xmlport.
To do this I have created a Codeunit to generate the same csv file using Excel Automation in same database. I have checked the csv files generated from the codeunit is perfectly matching with the dataport generated csv file.
But the 3rd Party software is not accepting the codeunit generated csv files due to find inappropiate character in the files. :shock:
How does the 3rd Party Software see the codeunit generated files is given in an attachment files.
How to solve this type of issues ?
Now or Never
0
Comments
-
How did you verify that the 2 files are identical? By opening them in excel?...then they will look identical
Check in Notepad..
| is not av valid field separator in csv format...Excel therefore consider the |-s to be alfanumerical fields, and add "" around them before saving the file.
If you use Excel Automation to generate the file, and save the file via .SaveAS method, excel will add the "'s
Save the file via File or OutStream instead0 -
Thanks for reply.
Files are similar in Excel view only.
As per the requirement of the third party tool we have to consider the | as a field separate.
I hope C/AL can do the same task as dataport can do.
Using Excel Automation & SaveAs(FileName,6) function I am trying to achieve the same.Now or Never0 -
Thanks for reply.
Files are similar in Excel view only.
As per the requirement of the third party tool we have to consider the | as a field separate.
I hope C/AL can do the same task as dataport can do.
Using Excel Automation & SaveAs(FileName,6) function I am trying to achieve the same.Now or Never0 -
If you want to use Excel, you'll have to put up with whathever Excel considers CSV, or try to coerce excel into doing what you want, but mind, Excel can be very stubborn.
So, along with eyolftho, I strongly advise to use outstream and it's TEXTWRITE function (It's much more reliable and more easy to control that FILE's TEXTMODE WRITE).
Forget about excel, both, as a means to create the file and as a means to verify it.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions