Processing Ajax...

Close Dialog


Close Dialog

Close Dialog

Close Dialog

Excel Cells to CSV Entries

This macro takes the Excel cells from the clipboard and adds them to the ClipboardFusion history as comma separated entries.
Minimum Version
Created By
Thomas Malloch (BFS)
Date Created
Jan 14, 2022
Date Last Modified
Jan 14, 2022

Macro Code

using System;
using System.Collections.Generic;

// The 'text' parameter will contain the text from the:
//   - Current Clipboard when run by HotKey
//   - History Item when run from the History Menu
// The returned string will be:
//   - Placed directly on the Clipboard when run as a Macro
//   - Ignored by ClipboardFusion if it is 'null'
//   - Passed along to the next action in a Trigger (null changed to an empty string)
public static class ClipboardFusionHelper
	public static string ProcessText(string text)
		// Clean up line breaks
		text = text.Replace(Environment.NewLine, "\n")
				.Replace("\0", "")
				.Replace("\r", "");

		// Get the lines from the text
		string[] lines = text.Split(new [] {'\n'});
		// Reverse the order of the lines so that they appear in the right order in this History
		// Loop through the lines and replace the tab characters with ", " then add them to the History
		foreach(string line in text.Split(new [] {'\n'}))
			BFS.ClipboardFusion.AddHistoryText(line.Replace("\t", ", "));
		// Tell ClipboardFusion to ignore the result of this macro
		return null;