How to use activity Read CSV with Int32 as column type

Perhaps this question has been asked before but I’ve been searching the entire forum and couldn’t find a proper answer to my question.

I’m trying to read a set of data in a csv file with activity “Read CSV”. The data is 4 columns wide and 500000 rows long. The first column is an integer, but it becomes a String when it’s converted to the data table. Parsing it to an integer row by row takes a very long time (15-20 minutes), whereas just reading it with the “Read CSV” activity in itself takes less than a minute.

Is there a way to read the data where the first column becomes an Int32 type straight away? Or otherwise a quick way to convert a String type column to Int32?

2 Likes

Convert.ToInt32("") @eefzter

cheers :smiley:

Happy learning :smiley:

2 Likes

Thanks @pattyricarte for your response. What activity do I use to apply this to a particular column? And how do I put this into a data table? Could you give an example?

1 Like

@eefzter How many Columns you want to Convert to Integer ?
Have you Checked this Activity :

3 Likes

Hello @eefzter, I know it’s bit tricky, but you can try following workaround.

Step 1: Read CSV
Step 2: Use Output Data Table activity to get in memory string
Step 3: Use Generate Data Table activity to get final output data table. Please use setting shown in following image.

Happy Automation… :slight_smile:

2 Likes

I would like to convert one column. Thank you for your suggestion! I’m not sure if my project (on an external company laptop) allows for imported activities, but I will definitely try this one later! Thanks again.

This worked for me! Thanks for you help :smiley:

@eefzter, Glad to know it helps. I wish something similar to AutoDetectType property (like Generate Data Table activity) will be available for Read CSV activity in future releases.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.