Importing and Saving CSV Files ABB Issue with Save Format

  • I am working with multiple CSV files (mostly positional data) importing into the controller. The application will allow someone to generate a CSV from Excel, import into the Robot and then also allow these positions to be touched up on the actual Robot and update the CSV file with the new data.

    It is all working but I am facing some issues surrounding the formatting of the CSV's and how the actual controller interprets them.

    The CSV when loaded from my PC is Windows format but when the controller resaves it is UNIX.

    The issue is the line breaks are interpreted differently depending on the file encoding.

    Does anyone know any way of identifying the encoding or even better saving as windows ( I doubt this is possible)

    Just wondering if anyone has ever tried doing anything similar or come across this.

    The worst part of this issue is if I work on a virtual controller the application works fine (because it remains in windows format).

    Otherwise I am going to have to identify the differences between the line breaks or add a step to the process of converting which is not ideal.

  • Place your Ad here!
  • Lemster68

    Approved the thread.
  • Its programmatically to streamline the process for a maintenance person.

    This makes it easy for "touch ups". If a position gets updated the user gets a prompt to save the position permanently to the CSV.

    It looks like I was able to work around this issue. A line break in UNIX is interpreted differently than Windows.

    Windows will be [CR][LF] from a CSV saved in excel.

    UNIX interprets only [CR] for a line break.

    When generating a file in RAPID a Line break is strictly [CR] which causes issues for reading and writing.

    I was able to actually write a line break "\0D" along with the Write command.

    This adds my [CR] and the Write command puts the [LF] getting me back to windows format.

    Crazy part about this is because the virtual controller is running on windows it stays in the proper format. The work around is only needed on real controllers.

  • Mmm... For a moment, I thought that using the "Save as Macintosh CSV" option in Excel might do it, but no dice. That's strange, b/c OSX uses a single CR newline, with no LF.

    Oddly enough, "Save As Macintosh Text" gave me a space-separated file that only had CR as the line break, with no LF. So I suppose that might be a way to go.

    Off the top of my head, the other option I can think of is to make an Excel macro that takes the spreadsheet contents, and generates the CSV file for the robot by directly writing CRs without LFs - in other words, using "raw" write commands as opposed to "writeline" commands:

    How to write text file without [0D 0A(VBCRLF)] at the End using vba
    I am developing process that copy text file and edit text file content according to Excel data by using FileSystemObject. Although Line Break Code of…

    Going from the robot to Excel, I'd say another Excel macro doing the opposite would be the simplest approach. Or, the RAPID Write command has a "no newline" option, so you can concatenate variables into a single line, then use a Write " "; command to append the newline. I've never had any issues with Excel opening a CSV file generated from the controller this way.

  • Thanks for the insight ! Definitely a few more options for me.

    The write command alone with the added [CR] was able to do the trick for me and keep the files consistent in a windows format for operation both ways.

    My only head ache now is my code won't work as is on a virtual controller so I am forced to do debug on real controller. But it is working now so I am happy.

    Virtual Controller vs Real Controller OS's different = different CSV interpretation.

    Very weird one for me and strange I haven't seen anyone come across this one online anywhere.

    I guess next step may be to identify VC vs Real for Robustness. Kind of a pain but at least the application will be seamless.

    IF RobOS() THEN
    Execution statements in RC
    Execution statements in VC

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now

Advertising from our partners