P
P
photosho2021-07-09 13:26:52
excel
photosho, 2021-07-09 13:26:52

Is it possible to convert cell indents to tabs?

There is an Excel file with a list of strings, in which some kind of nesting is implemented due to indents in cells (Cell Format> Alignment> Indent). That is, the indents are only visual. This file needs to be exported to csv and then parsed programmatically. Of course, when exporting to csv, the indents do not get there in any way. Tell me, is there any way to convert indents to text in this case? Perhaps there is a suitable function in Excel itself?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Akina, 2021-07-09
@photosho

The indents themselves cannot be turned into tabs.
Create a function:

public function get_indent(rng as range) as integer
    get_indent = rng.indentlevel
end function

In a separate column, use it:
B1 = get_indent(A1)
Accordingly, when exporting, you will receive an additional column with the level. After import - use this value.
Alternatively, you can add the required number of tabs to the beginning in one more column based on the values, and export only this column.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question