Michael S - 9 months ago 81

C# Question

I am exporting a smartsheet, and in order to maintain the hierarchy of rows, I need to use Excel format (can't use CSV). I'm wondering if IExcelDataReader will support this hierarchy of a row being contained inside of another row. I am not finding any documentation on this.

Answer Source

I don't see anything in IExcelDataReader that mentions Excel Row Groups. But there is an easier way that won't require you to use Excel sheets at all.

In Smartsheet, you could add another column, and add the formula `=COUNT(ANCESTORS())`

to each row. This will give you a numerical value you can work with in CSV format. Topmost rows will have a value of 0, children of topmost rows will have 1, and so on. In the logic that manipulates your CSV, you can then determine the hierarchy quite easily.