Read a CSV File

HI All,

I have a requirement to process a CSV file to my database. i have used a smart service(Export CSV to Database) from Excel Tools plugin. But some of the special characters are not read properly.
For example: 

The data i have received in CSV has : ~@ö<é;ó¿üäÖÇ*àÄ=É!"ѧæñ á½èçòíê°

after consuming the file i have got this in my database : ~@�<�;�����*��=�!"ѧ��������

Can anyone suggest if we have any alternative options for this please.

Thanks,
Sai Kiran Pannala.

  Discussion posts and replies are publicly visible

  • 0
    Certified Associate Developer
    in reply to Stefan Helzle
    As suggested by  , you can parse the CSV file manually.
    Sample code to read and parse the CSV file manually:
    a!localVariables(
      local!fileData: readtextfromfile(
        txtFile: ri!csvDocument,
        preserveLineBreaks: true
      ),
      local!fileLines: split(local!fileData, char(10)),
      a!forEach(
        items: local!fileLines,
        expression: if(
          fv!isFirst,
          {},
          a!localVariables(
            local!splitItem: split(fv!item, ","),
            /*Create Records or CDT  */
          )
        )
      )
    )
    Hope this helps.