Add an incrementing identity column to a file

Two questions:
1) Is there a way to create a new column (i.e. ID) to an existing file containing data and the new column ID populate as an auto incrementing number?
for example:
(Current file has headers and is PIPE delimited.)

data looks like this
"COL1"|"COL2"|"COL3"|"COL4"|"COL5"
"A1"|"B1"|"C1"|"D1"|"E1"
"A2"|"B2"|"C2"|"D2"|"E2"
"A3"|"B3"|"C3"|"D3"|"E3"

would like for it to be like
"ID"|"COL1"|"COL2"|"COL3"|"COL4"|"COL5"
"1"|"A1"|"B1"|"C1"|"D1"|"E1"
"2"|"A2"|"B2"|"C2"|"D2"|"E2"
"3"|"A3"|"B3"|"C3"|"D3"|"E3"

2) Is there a way to replace an existing column with a New column for an existing file containing data. The new column would be "ID" and populate as an auto incrementing number?
for example:
(Current file has headers and is PIPE delimited.)
data looks like this
"COL1"|"COL2"|"COL3"|"COL4"|"COL5"
"A1"|"B1"|"C1"|"D1"|"E1"
"A2"|"B2"|"C2"|"D2"|"E2"
"A3"|"B3"|"C3"|"D3"|"E3"

would like for it to be like
"COL1"|"COL2"|"ID"|"COL4"|"COL5"
"A1"|"B1"|"1"|"D1"|"E1"
"A2"|"B2"|"2"|"D2"|"E2"
"A3"|"B3"|"3"|"D3"|"E3"

Hoping someone can help provide a solution for both scenarios. I have tried so many methods (i.e. awk, sed, ect) with no luck.