3 Replies Latest reply on Sep 8, 2016 7:28 PM by MikeWood

    Is there a way to strip the first row of a CSV?

    MikeWood

      So I'm working on a .CSV import feature from a lighting control console. Unfortunately, I'm limited in what the CSV looks like when it comes off of the lighting board. Right now I'm getting:

       

      Row 1 - TITLE

      Row 2 - COLUMN HEADERS

      Row 3+ - DATA

       

      I want to strip that first row from the CSV automatically because obviously when I try to import it right now it looks for field names in row one when they're actually contained in row 2.

       

      I can obviously just delete that first row in excel and then do it, but I'm trying to make it as seamless as possible. Maybe if FileMaker can't do this on its own, I could do something in applescript? Luckily the row one contents are always the same.

       

      Any ideas?

        • 1. Re: Is there a way to strip the first row of a CSV?
          IT_User

          I don't know about AppleScript, because that may work.

           

          I think that if you import into a holding/temporary table that usually helps.  The data can be manipulated there, and then import from that table into the correct one.

          If it is just deleting the first blank row this might make this process longer than just deleting the first row, but it does make it more seamless in the end.

          1 of 1 people found this helpful
          • 2. Re: Is there a way to strip the first row of a CSV?
            BowdenData

            In the import settings - tell it to skip the first row (Title). It will then import the 2nd row containing the column headers along with the data from row 3 onwards. In the found set after import, the first record will contain the column header text in the various fields. You can just delete this record right after the import in your script. To be safe, it would make sense to test the value(s) in some of the fields for the first record. If they match the column header names, then delete it.

             

            HTH.

             

            Doug

            1 of 1 people found this helpful
            • 3. Re: Is there a way to strip the first row of a CSV?
              MikeWood

              Thanks - I ended up doing this and then having it automatically find that record and delete it as part of the importing script.