Skip to main content
February 24, 2026
Question

how to check is .csv file is corrupted or not

  • February 24, 2026
  • 12 replies
  • 0 views

hi,

is there any function that we can check  is .csv file is corrupted or not?

note:-.csv.file will receive from external system 

suggest me best approch?

    12 replies

    shubhama926776
    February 24, 2026

    Does corrupted file mean a file that cannot be opened at all due to some malfunction or damage?

    February 24, 2026

    hi[mention:9861aef97eb2483a8b76175d9eda1e37:e9ed411860ed4f2ba0265705b8793d05] , yes if the file can't open due to password or someother reason's. then that time we should make a entry in db that file is corrupted. for that how we can handle?

    shubhama926776
    February 24, 2026

    PM Exception Flow is your only native way to catch can't open scenarios.
    Receive File -> Try to Parse CSV -> if Success: Process Data ; if Exception: Write "CORRUPTED" to DB -> Notify Team.

    harshas2775
    February 24, 2026

    I assume if a file is corrupt then any function or smart service trying to read data from it will not behave as expected. So you can try reading data from the file and log accordingly if its successful or not.

    stefanhelzle0001
    February 24, 2026

    A CSV file is just text. So technically it cannot be corrupt or encrypted. But it might happen that it does not follow the expected schema. You could try to read the first line and check the column names against your expectations.

    mikes0011
    Brainy
    February 24, 2026

    If you're getting "bad" CSV files, open one in Notepad++ and see what text it contains, and check to see if the 'bad' version is consistently the same.

    If it's consistent, then use the "read text from file" utility to do an initial reading of the CSV file and scan for some of the text you'd expect to (only) see in the 'bad' file.  If so, route elsewhere.  If not, attempt to read it using your in-process reader of choice.  (Note: this requires you to do the reading via a process model, but I'd recommend you do that in any case).