Issues with CSVFileToArray

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
SandyDoss
Junior Coder
Posts: 40
Joined: Wed Sep 07, 2016 12:47 am

Issues with CSVFileToArray

Post by SandyDoss » Wed Feb 01, 2017 1:05 am

Hello,

I'm attempting to read in a series of records from a .csv file. I was really excited to see that you have the CSVFileToArray command, as it purports to do just what I need.

However, my code:

Code: Select all

CSVFileToArray>c:\Users\admin\Documents\TransferCredits.csv,csvData
MessageModal>Rows: %csvData_count%
Results in the following in the Watch List:

Code: Select all

0: CSVDATA=##NOFILE##
And the message?

Code: Select all

Rows: %csvData_count%
I know the answer is simple (isn't it always?). I've checked the location of the file, and permissions. Any thoughts?

Thanks in advance,
Sandy

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Issues with CSVFileToArray

Post by JRL » Wed Feb 01, 2017 4:42 am

Your results suggest the path or filename are incorrect.

Recheck the path\filename spelling. Or do as I always do, open Windows explorer and copy and paste the path fro the location bar then type a backslash. Then, back in windows explorer, right click and pick rename on the file and copy and paste the filename after the path. I do it this way 'cause I'm a lousy typist.

SandyDoss
Junior Coder
Posts: 40
Joined: Wed Sep 07, 2016 12:47 am

Re: Issues with CSVFileToArray

Post by SandyDoss » Wed Feb 01, 2017 5:27 pm

I'm an idiot. This is what happens when you stare at something for hours.

The filename was misspelled :oops:

Thanks for the mild slap :D

Sandy

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1389
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Issues with CSVFileToArray

Post by Dorian (MJT support) » Tue Feb 07, 2017 2:03 am

Sandy, you'd be amazed at how often we see this, in the support department.

I often send this little snippet to people. Using Input to navigate to the file in question and then copying the result eliminates the likelihood of file path typos...

Let>MSG_HEIGHT=300
Let>MSG_WIDTH=300
Input>FileLocation,Click on the folder to the right and navigate to your file,c:\...
MessageModal>Your File Location is :%CRLF%%CRLF%%FileLocation%%CRLF%%CRLF%Copy and paste this into your script
Yes, we have a Custom Scripting Service. Message me or go here

SandyDoss
Junior Coder
Posts: 40
Joined: Wed Sep 07, 2016 12:47 am

Re: Issues with CSVFileToArray

Post by SandyDoss » Tue Feb 07, 2017 3:14 pm

Dorian, thanks for the snippet.

I've been in the business of software development for a very long time. It's a little humbling to realize I am, in the end, a user just like everyone else :D

I'll take your snippet and put it in my collection.

Sandy

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1389
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Issues with CSVFileToArray

Post by Dorian (MJT support) » Fri Mar 03, 2017 12:57 am

If we didn't have moments like that, we wouldn't be human. That's why I have snippets like that to make up for my (very occasional) shortcomings. :D
Yes, we have a Custom Scripting Service. Message me or go here

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts