Validate table's columns before replacing

Options

Hi, I'm going to replace a data table with a new one imported as an excel file. But I need to be sure that the column names won't change, and the table will only be replaced if the structure is exactly the same.
I think I could do this converting the data table to a string and checking the column names. But is there any other way of doing this now?

Answers

  • Jozef_783863
    Jozef_783863 Posts: 331 admin
    Options

    @Lucas_116196, it sounds like you can use a combination of the following two methods:

    Imported Table Remove All Rows (Community Question)
    https://community.pushbot.com/discussion/1280

    This first method includes suggestions for clearing data table rows (keeping the column header).

    Updating Data Tables > Add data from another file (Help Article Documentation)
    https://help.catalytic.com/docs/updating-data-tables/#add-data-from-another-file

    This second method includes instructions on how to add data from a file (with the "same number of columns, same column names, and same column order as the data table").

  • Lucas_156486
    Options

    Hi, Jozef. Thanks for replying.
    I want to make this replacing inside a workflow so that the processes owner will be able to update the data table from a webform upload a file command.

    The problem is if by any chance the process owner changes the name of one column, it will cause many errors later on. I would like to have a way that if the structure is different from the original master table, I would not replace it with the new file and I would send him an e-mail.

  • Lucas_156486
    Options

    Ok, i think I managed to solve this with Excel: Extract range and using the output type as JSON.
    Later, I used a condition in a task Excel: Save spreadsheet to table comparing to the JSON field and setting Overwriting existing table to TRUE.

  • Jozef_783863
    Jozef_783863 Posts: 331 admin
    Options

    Hi @Lucas_116196, glad to hear you have an approach identified. Please let us know if you had any further questions on this topic.