CSV

  • 05 Jan

    How to remove the header row from a CSV file

    How to remove the header row from a CSV file

    Q: We have a CSV file that contains a header row.  Is it possible for Limagito to remove the first row in the file when we move it to a new folder?  Both the start and ending locations are on a windows server.

    A: Yes, this is possible. Please have a look at the following screenshots.

    • The customer is using a Windows folder as Source so we used this also in our example:

    limagito file mover Windows folder as source

    • We added an include filename filter so we are 100% we’ll only pickup .csv files:

    limagito managedfiletransfer filename filter

    • In our Destination setup we added our ‘Pascal Script’ option:

    limagito managedfiletransfer destination setup

    • Please add the following script (v1): link
    • We also added an alternative for the first script. In this script you can enable or disable the “TrailingLineBreak = finishing line break” (v2): link
      • psSaveListToFile(tmpList, tmpOutputFile, False);
      • psSaveListToFile(tmpList, tmpOutputFile, True);
    • We even added a third possibility where you can change the encoding and BOM of the resulting Csv file (v3): link
    • If you would need a different option, please let us know, many options are possible.

    remove the header row

    • RunTime Log Result:

    remove the header row

    #csv #managedfiletransfer #filetransfer #filemanagement

    If you need any help with this ‘remove the header row’ question, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team CSV Pascal Script , , ,
  • 30 Dec

    Split delimited files based on duplicate column

    Split delimited files based on duplicate column

    Q: We receive | (pipe) delimited files (no double quotes):

    Rvman International Inc. – US|CONTENT + US|1310001|0000000122|10/25/2023 1:54 PM
    Rvman International Inc. – US|CONTENT + US|1310002|0000000616|0/25/2023 2:10 PM
    Rvman International Inc. – US|CONTENT + US|1310002|0000000616|0/25/2023 2:10 PM

    Is it possible to create separate files of rows with the same content in column 4?

    The filename(s) would be incremental:

    original .csv

    Rvman International Inc. – US|CONTENT + US|1310001|0000000122|10/25/2023 1:54 PM

    original1.csv

    Rvman International Inc. – US|CONTENT + US|1310002|0000000616|0/25/2023 2:10 PM
    Rvman International Inc. – US|CONTENT + US|1310002|0000000616|0/25/2023 2:10 PM

    Thanks for such a great product!

    A: Yes this is possible using our Pascal Script option

    We used a Windows folder as Source. In this folder we’ll search for .csv files.

    limagito file mover as source

    Since we are only interested in .csv files we added a filename include filter. We want to be sure we’ll only handle .csv files.

    limagito filemover filename filter

    As Destination we used our Pascal Script option. Please replace the default Destination Pascal Script.

    You can download the script: here

    The script will read the csv file with  a pipe as delimiter (this can be adjusted > ctPipe constant). We’ll check the content of column 4 which is index 3 (TStringList = zero index based).

    tmpCol4 := tmpPipe.Strings[3];

    Limagito File Mover pascal script as destination

    Output Result:

    Split delimited files based on duplicate column

    RunTime Log Result:

    limagito file mover runtime log result

    #csv #managedfiletransfer #filetransfer #filemanagement

    If you need any help with this ‘Split delimited files based on duplicate column’ question, please let us know.

    Best Regards,

    Limagito Team

  • 19 Nov

    How to move files based on data from a csv file

    How to move files based on data from a csv file

    Q: I have the Limagoto X software installed, and I would like to know if it’s possible to move files, based on some information from a csv file? I have an csv file with some order numbers, and the folders I want to move, are label with these order numbers.

    A line in the csv file would look like this:

    The file structure looks like this:

    limagito file mover folder structure example

    So I would have to extract “D” first letter of “Donald Duck” -> then look in folder “Donald Duck”\ordre and search for 9999999 and move that folder to a new location with the same folder structure.

    A: We asked and received a dummy csv file, data content lookes like:

    Art;Ordrenr.;Arkiveret;Arkivdato;Jobnavn;Kundenavn;Statuskode;Ordretype;S‘lger;Ordrestyrer
    Ordre;9876543;SAND;17-11-2023;Arkiveringstest;Limagito Complete;AABEN_ARKIV;ARK;TEAM-E;MHOE

    So in this example:

    • We would strip the first char of the ‘Kundenavn’ field:  L
    • Next it would be the full name of the same ‘Kundenavn’ field:  Limagito Complete
    • Add fixed text:  Ordre
    • And finally the value of data field ‘Ordre’:  9876543

    Result as Directory filter: *\L\Limagito Complete\Ordre\9876543\*

    • As source we used a Windows folder, root folder to start from is ‘Jobs’ :

    limagito file mover windows folder as source

    • Next we’ll need to add a ‘Pascal Script’ to strip data from the csv file and use it as directory filter:

    limagito file mover pascal script option

    • Enable and add the following ‘On Rule Begin’ Pascal Script:

    You can download the script: here

    Do not forget to adjust the ctDataPath const (must end with a \ ). In this path we’ll search for .csv data file(s) with a date structure in its filename like ‘YYYY-MM-DD’. This can, of course, be adjusted.

    limagito fil emover move files based on data from a csv file

    • Directory filter setup:

    limagito file mover directory filter setup

    The %VSA (= Var String A) configured by the previous script will be used as ‘Directory Name Include Filter’:

    limagito file mover directory filter

    This ‘Allow parameters in Directory Name Filter’ option should be enabled by default:

    limagito file mover directory filter

    • As Destination we used a Windows folder:

    limagito file mover windows folder as destination

    • RunTime log result:

    limagito file mover runtime log result

    #csv #managedfiletransfer #filetransfer #filemanagement

    If you need any help with this ‘move files based on data from a csv file’ request, please let us know.

    Best Regards,

    Limagito Team

1 2 3
SEARCH