Options

Import of csv file with ExcelBuffer?

NavGuyDKNavGuyDK Member Posts: 4
Is it possible to import a csv file into a Nav table using the ExcelBuffer table?
(I am aware of other solutions)

I have coded a function that uses ExcelBuffer, but it ignores the delimiters (;) in the csv file.

If I import the csv file into Excel and save it as an Excel file, then the import works fine.

Comments

  • Options
    vaprogvaprog Member Posts: 1,125
    Did you try? What happened?

    If it does nor work 'out of the box' you might have to create an alternate OpenBook function.
    Have a look at the XlApp.Workbooks.Open function and MSDN's documentation of it.

    However, why would you want to do it? The risk of Excel altering your data is much too high, in my opinion. Some of the problems you will experience are missing leading zeros, numbers converted to dates, numbers changed to scientific notation, problems with decimal and thousands separators, wrong file encoding (Excel sometimes just guesses wrong and it is not trivial to force it to use the right one), ....
  • Options
    NavGuyDKNavGuyDK Member Posts: 4
    Yes, I Tried. The delimiters (;) were ignored, so that there was only one column pr. row instead of 2 columns.

    I was just curious about how the ExcelBuffer works regarding importing csv files because some topics in this forum indicates that it could work.

    Thanks for the link to the doumentation for the XlApp.Workbooks.Open function and for mentioning the disadvantage using ExcelBuffer.
  • Options
    ara3nara3n Member Posts: 9,256
    Why aren't you using dataport/xmlport?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    NavGuyDKNavGuyDK Member Posts: 4
    ara3n wrote:
    Why aren't you using dataport/xmlport?
    As written earlier I am aware of other solutions ;-)
    I was just wanted to konw how the ExcelBuffer works regarding importing csv and I think I got a good answer from vaprog :-)
Sign In or Register to comment.