Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Quoted CSV Output From Tab Delimited Data

Description
Takes tab delimited data (including data copied from Excel), and converts it into a comma separated values (CSV) or comma delimited format where each field is surrounded by quotes. This helps in situations where each field in a CSV file needs to be quoted since saving a file as a CSV from Excel will only place quotes around fields that happen to have commas in them. There are no options in Excel to quote all output.
Language
C#.net
Minimum Version
Created By
wooster11
Contributors
-
Date Created
Aug 19, 2014
Date Last Modified
Aug 13, 2019

Macro Code

using System;

public static class ClipboardFusionHelper
{
    public static string ProcessText(string text)
    {
        System.Text.StringBuilder output = new System.Text.StringBuilder();
        System.IO.StringReader sr = new System.IO.StringReader(text);
      string line = null;

        line = sr.ReadLine();
      while (line != null)
      {
          string[] parts = line.Split('\t');
          output.AppendFormat("{0}{1}{0}{2}", '"', String.Join("\",\"", parts), "\n");
            line = sr.ReadLine();
      }

        return output.ToString();
    }
}