CSV File: Remove quotes from the file.

Certified Senior Developer

Hello Everyone,

I am converting HTML to CSV using this process nodes and it's working fine. Although I can export data store entity to CSV- but there is different requirement, so I am not using this approach. Please see below screenshot. 

Requirement: When I open that CSV file in Notepad++ I see this:


I need to remove these quotes in a file. How can I achieve this?

Thanks

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    in reply to manjit.1486

    You won't be able to make any edits to the original CSV file in Appian (and if you removed the quotes somehow, it would no longer *actually* be a "CSV" file, since the quotes are a required part of the parsing).  If you're hoping to ONLY show the end user the result with the quotes stripped, you would probably be able to have the "generate CSV" process also take the resulting CSV, read the information in as text, strip double quotes, dump the results back into a (new) TXT file, then **only** show that on the user's interface.  If the user was expecting a "CSV" though that isn't what they'll be getting anymore, so I would consider renaming the "generate CSV" button as well while making these other changes.

    Note: I'm fuzzy on how easy / possible it is to read data as text from a CSV file, but i'm pretty sure that after you have the resulting information, it'll be pretty simple to use the "text from template" smart service and drop the resulting rows of text into a new text file.  This can be displayed on-form pretty easily (i'm not sure what you mean by "editor" though).

  • 0
    Certified Senior Developer
    in reply to Mike Schmitt

    I tried to read data using smart service Txt from template. It worked. The problem is one file they need which is CSV and and can be edited in notepad without quotes.

  • NOTE, if you are only removing quotes from the CSV file, you may be left with values within the quotes that contain a comma that is not intended to be used as a delimiter, this will break your entire file.  This is the purpose of quoting all values within a CSV, which is essentially a standard that all systems designed to accept CSV should honor, in my opinion.

    And what is the data like that is coming into the initial HTML node, from a DB query etc?  Can you utilize an expression rule to build the CSV file?

    In all the CSV files I create, I generate the contents via an expression rule, which gives you full control over the output, then run that into a Text Doc from Template node which only has one placeholder (for the entire text).  As I type this however I realize that all of my CSV files are SFTP'd out, which is where I convert them from .txt to .csv, I'm not sure if we have an other way to change file types in Appian..

  • 0
    Certified Senior Developer
    in reply to Chris

    I am taking data from process variables. because at this time data is not saved into database which is the reason I am not using Export data store entity to CSV. 

    What I have done. I have used node HTML Doc from Template. In this template I have designed a table form data as mentioned below..

     <HTML>
     <head></head>
        <BODY>
    <form>
           <table name="Add" style="border:2px solid black" width="100%" border="1" cellpadding="5" cellspacing="0">
                    <tr>
                      <th><label> <b> Name </b> </label> </th>
                      <th><label> <b>  Date </b> </label> </th>
                      <th><label> <b> Address </b> </label></th>
                      <th><label> <b> Department </b> </label></th>
    				  <th><label> <b> Country </b> </label> </th>
                   </tr>
    			    ###details###
               </table>
    </form>
    </BODY>
      </HTML>


    In ###details###- I have created a rule that will get data from process variables. Followed by that - all data converted into csv file using HTML to CSV smart service.

  • 0
    Certified Lead Developer
    in reply to manjit.1486

    If you remove the quotes, it's not a CSV file anymore.  If someone is telling you otherwise, you should escalate this requirement high enough to get someone who understands the technical details, because this makes very little sense as-is.

  • 0
    Certified Senior Developer
    in reply to manjit.1486

    HI   can you guide this thing? Is it possible to change the extension of text file into CSV?
    Like I am able to achieve the text document from that smart service. Can we update the extension of that documnet to CSV?

  • 0
    Certified Lead Developer
    in reply to manjit.1486

    You can TRY to put in the full output file name like "myExport.CSV", but Appian does not always give THAT much control over file extensions (and no direct means by which to CHANGE the extension of an existing file, that I know of).  However I feel I need to point out one more time that the resulting file you're creating is NOT A CSV FILE any more, because removing the quotes breaks all CSV file conventions.

  • 0
    Certified Senior Developer
    in reply to Mike Schmitt

    I agree. I will try if that works. Does this mean output file name? 

  • 0
    Certified Lead Developer
    in reply to manjit.1486

    in many (but not all) document generation smart services, one of the input parameters will be something like "generated file name", and govern what the actual filename is for the generated doc.  The thing in your screenshot will be a reference to the generated doc ID (to be saved into a "document type" pv, as a reference to the created document itself), so not the same thing.

    In the "text from template" node, it's in the Setup (highlighted).  I'm unclear whether providing a name (dot) extension here will allow you to override the default ".txt" extension (i'd guess no, but you can still try and see what happens).

  • 0
    Certified Senior Developer
    in reply to Mike Schmitt

    Nothing happened. I tried with "CSV.csv" and .csv