KAPOW

Would you like to react to this message? Create an account in a few clicks or log in to continue.
KAPOW

Welcome to the Kapow forum. Here you can get help, use your skills to help others and enjoy hanging out in the company of other Kapow Robot Developers.


2 posters

    Data Extraction in CSV

    avatar
    Ravi


    Posts : 10
    Points : 1890
    Join date : 2019-03-22

    Data Extraction in CSV Empty Data Extraction in CSV

    Post by Ravi Mon Mar 25, 2019 8:20 am

    Hi All,

    I am very new to Kapow and facing some challenges, hope this community can help me:

    Currently I am trying to extract some data from Website and want to write comma delimited csv file so I can import into our system. So far I have able to extract data of the website but facing challenge to write in csv format.
     
    1.            Is it possible to extract Return Value data and write in csv format?
    2.            Or Is it possible to extract data from Excel variable and write in csv format?
    3.            I have also tried Assign variable to extract data into it and then Add to CSV function but it only gives me one line only, but I need the whole data (multiple lines)
    3.            Or any other suggestion?


    Regards,
    Ravi
    jking
    jking


    Posts : 103
    Points : 3863
    Join date : 2014-03-01
    Location : USA

    Data Extraction in CSV Empty Re: Data Extraction in CSV

    Post by jking Tue Mar 26, 2019 12:00 am

    1. Is it possible to extract Return Value data and write in csv format?   Yes.
    2. Or Is it possible to extract data from Excel variable and write in csv format?  Yes.

    Regardless of whether you are extracting data from a Website or from an Excel Spreadsheet you can output the data to a .csv.

    Here is how I accomplish this:
    Add a Long Text Variable (in my example I named this CSV).  This needs to be set to Global.
    Add a Short Text Variable (in my example I named this csv_line)
    Extract data from Website/Excel as desired.
    Insert an Assign Variable Step (in my example I named this Assign csv_line).  Variable is csv_line.  Value is an expression variable1 + ", " + variable2 + ", " + variable3 + ", " + variable4 + ", " + variable5 etc., where variable1,2,3,etc are your extracted variables.  The comma is added to create the comma separated variable.
    Insert an Assign Variable Step (in my example I named this Update CSV.  Variable is CSV. Value is an Expression CSV  + "\n" + csv_line.  This step takes the CSV long text variable and adds the next (or initial) line.  In this step you are building your rows.
    Continue looping/extracting data and adding each new line to the CSV.
    When looping/extracting is completed, Insert a write file step to output final CSV.

    1. File Name is your complete file path including file name 
    2. File Content is a Converter.  Variable to Format is CSV.  Field Separator is Comma (values enclosed in quotes). Create Directories is optional.  Execute in Design Mode is Optional.


    Data Extraction in CSV Csv14
    avatar
    Ravi


    Posts : 10
    Points : 1890
    Join date : 2019-03-22

    Data Extraction in CSV Empty Re: Data Extraction in CSV

    Post by Ravi Tue Mar 26, 2019 11:23 am

    Thanks. Much appreciated. Able to extract in csv now.
    avatar
    Ravi


    Posts : 10
    Points : 1890
    Join date : 2019-03-22

    Data Extraction in CSV Empty Re: Data Extraction in CSV

    Post by Ravi Wed Mar 27, 2019 10:33 am

    HI JKing,

    I need to ask once more thing. 
    I have been able to extract the data in csv, but when I open the csv data (right click csv file>>Open with Notepad) in Notepad the data is not showing up in correct format. All the lines are merging in Notepad even I got "\n" as Linebreak. Refer attached snaphot.

    Regards,
    ravi
    avatar
    Ravi


    Posts : 10
    Points : 1890
    Join date : 2019-03-22

    Data Extraction in CSV Empty Re: Data Extraction in CSV

    Post by Ravi Wed Mar 27, 2019 10:36 am

    CSV Extract
    avatar
    Ravi


    Posts : 10
    Points : 1890
    Join date : 2019-03-22

    Data Extraction in CSV Empty Re: Data Extraction in CSV

    Post by Ravi Wed Mar 27, 2019 10:38 am

    Data Extraction in CSV Csvfil11
    avatar
    Ravi


    Posts : 10
    Points : 1890
    Join date : 2019-03-22

    Data Extraction in CSV Empty Re: Data Extraction in CSV

    Post by Ravi Wed Mar 27, 2019 10:41 am

    Data Extraction in CSV Assign11
    Data Extraction in CSV Csvfil12
    Data Extraction in CSV Notepa12
    Data Extraction in CSV Writef12
    avatar
    Ravi


    Posts : 10
    Points : 1890
    Join date : 2019-03-22

    Data Extraction in CSV Empty Re: Data Extraction in CSV

    Post by Ravi Tue Apr 02, 2019 11:35 am

    I got it .. added \r & \n together to get the right output. All good now.

    Sponsored content


    Data Extraction in CSV Empty Re: Data Extraction in CSV

    Post by Sponsored content


      Current date/time is Thu May 09, 2024 1:22 pm