For text data, look for lines that don't contain an embedded space, then append " 0":
public List<string> CleanupText(List<string> inputLines)
{
List<string> outputLines = new List<string>();
foreach (string s in inputLines)
{
// Note: the Trim() and Replace() ensure that (a) there are no false hits and (b) no false misses, respectively
if (s.Trim().Replace('\\t', ' ').Contains(" "))
outputLines.Add(s);
else
outputLines.Add(string.Concat(s, " 0"));
}
return outputLines;
}
If you want to modify the collection in place, you'll have to replace the foreach() with a for() and an index into the list - since foreach() loops disallow modifying the collection they are iterating. To do this with Excel you'll have to iterate rows (the end condition being a cell in the first column that is empty), looking for cells in the 2nd column that are blank and inserting a '0' into those blank cells. I've not done enough MSOffice interop to be able to give you a code example.