<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Read a CSV File</title><link>https://community.appian.com/discussions/f/plug-ins/25204/read-a-csv-file</link><description>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</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Read a CSV File</title><link>https://community.appian.com/thread/136716?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2024 03:42:11 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6aa9d56b-70f4-44f4-990a-cec4fe7fd58d</guid><dc:creator>Yogi Patel</dc:creator><description>&lt;div&gt;&lt;span&gt;As suggested by &lt;a href="/members/stefanhelzle0001"&gt;Stefan Helzle&lt;/a&gt;&amp;nbsp;, you can parse the CSV file manually.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Sample code to read and parse the CSV file manually:&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;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, &amp;quot;,&amp;quot;),
        /*Create Records or CDT  */
      )
    )
  )
)&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Hope this helps.&lt;/span&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read a CSV File</title><link>https://community.appian.com/thread/136704?ContentTypeID=1</link><pubDate>Tue, 11 Jun 2024 19:44:16 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:40b89bb8-b028-4ad1-85c6-da7bc2b6c1e7</guid><dc:creator>nksnksnks</dc:creator><description>&lt;p&gt;Thank you Stefan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read a CSV File</title><link>https://community.appian.com/thread/136700?ContentTypeID=1</link><pubDate>Tue, 11 Jun 2024 19:00:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:59b02cae-19d9-4dce-9fe0-3c968153bbbf</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;That is a very common problem with CSV files. There is no defined standard.&lt;/p&gt;
&lt;p&gt;If your file is on the smaller side, you could try to use the &amp;quot;text file reader&amp;quot; plugin to read and parse that file manually.&lt;/p&gt;
&lt;p&gt;If you have a larger file, you could try to use another plugin to first convert that CSV into JSON and back to CSV. This way it could be more uniform.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read a CSV File</title><link>https://community.appian.com/thread/136698?ContentTypeID=1</link><pubDate>Tue, 11 Jun 2024 17:56:45 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3468831e-2a38-4898-b61f-a8cbe9f81371</guid><dc:creator>nksnksnks</dc:creator><description>&lt;p&gt;I&amp;#39;m uploading a CSV using import csv to database smart service, but the thing is some rows of the data containing double quotes in the values. for example: &lt;strong&gt;employee1;&amp;quot;1&amp;quot;;&amp;quot;name &amp;quot;&amp;quot;appian&amp;quot;&amp;quot;&amp;quot;;&amp;nbsp;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;so, I&amp;#39;m getting an error like&lt;strong&gt;&lt;em&gt;&amp;nbsp;java.lang.IllegalStateException: IOException reading next record: java.io.IOException: (line 175) invalid char between encapsulated token and delimiter.&amp;nbsp;&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;Is there any way to fix this or some workarounds?&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read a CSV File</title><link>https://community.appian.com/thread/136697?ContentTypeID=1</link><pubDate>Tue, 11 Jun 2024 17:45:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:734b91d4-5c84-4af2-be54-99f78c5d5434</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Similar issue can mean a lot. Let&amp;#39;s take the guesswork out. Can you share some details?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read a CSV File</title><link>https://community.appian.com/thread/136696?ContentTypeID=1</link><pubDate>Tue, 11 Jun 2024 17:34:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5e4867b4-59c8-4059-b6e7-c279d0487236</guid><dc:creator>nksnksnks</dc:creator><description>&lt;p&gt;Hi sai,&lt;br /&gt;&lt;br /&gt;I&amp;#39;m facing similar issue. how did you resolve this or any suggestions to work on &lt;a href="/members/stefanhelzle0001"&gt;Stefan Helzle&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read a CSV File</title><link>https://community.appian.com/thread/98419?ContentTypeID=1</link><pubDate>Tue, 26 Jul 2022 06:32:51 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:407a252f-45b1-4525-9f76-330d6ea5215b</guid><dc:creator>saikiranp0001</dc:creator><description>&lt;p&gt;Hi Stefan,&lt;/p&gt;
&lt;p&gt;Good Day!!&lt;/p&gt;
&lt;p&gt;After converting the file to UTF-8 the issue i mentioned got fixed but there is one another issue i am seeing now.&lt;br /&gt;If i use &amp;quot;&amp;quot; in any of the column then the node errors out and throws below error.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;java.lang.IllegalStateException: IOException reading next record: java.io.IOException: (line 3) invalid char between encapsulated token and delimiter&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Could you please suggest me on this.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br /&gt;Sai Kiran Pannala.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read a CSV File</title><link>https://community.appian.com/thread/97801?ContentTypeID=1</link><pubDate>Fri, 15 Jul 2022 11:01:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1d7cea8a-1c61-47bf-8dbd-26a5eccab14d</guid><dc:creator>saikiranp0001</dc:creator><description>&lt;p&gt;HI Stefan,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It worked when i converted the CSV file with UTF-8 encoding and then run it. Thanks alot for the quick help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read a CSV File</title><link>https://community.appian.com/thread/97788?ContentTypeID=1</link><pubDate>Fri, 15 Jul 2022 06:07:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4334f488-66c2-4a75-8be3-5a2cb3420b7f</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;I think the plugin expects the data to be encoded in UTF-8. Please check that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read a CSV File</title><link>https://community.appian.com/thread/97786?ContentTypeID=1</link><pubDate>Fri, 15 Jul 2022 06:01:22 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:863a6383-4640-42db-8099-fd0484d77348</guid><dc:creator>saikiranp0001</dc:creator><description>&lt;p&gt;HI Stefan,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Apologies if my statements were unclear.&lt;br /&gt;&lt;br /&gt;I am not exporting data from APPIAN.&lt;br /&gt;Basically i am getting data in a CSV file through SFTP integration from an external source. We need to consume that file into pur APPIAN database.&lt;br /&gt;While consuming the file i am using&amp;nbsp;&lt;span&gt;a smart service(Export CSV to Database) from Excel Tools plugin. And this smart service or plugin is unable to read few special characters as mentioned above.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read a CSV File</title><link>https://community.appian.com/thread/97785?ContentTypeID=1</link><pubDate>Fri, 15 Jul 2022 05:54:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0cbe1065-6a18-4a28-b691-455ccd71c5ef</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;So, you export data from Appian into a CSV and import it, where? Appian uses UTF-8 to export the data. Is the other DB set up to store unicode? Does the import read the data in unicode?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>