Link Search Menu Expand Document

Copy Worksheet Data To Clipboard - C#

Spreadsheet SDK sample in C# demonstrating ‘Copy Worksheet Data To Clipboard’

using Bytescout.Spreadsheet;
using System;
using System.IO;
using System.Text;

namespace CopyWorksheetDataToClipboard
    class Program
        static void Main(string[] args)
            // Spreadsheet document
            using (Spreadsheet document = new Spreadsheet())
                // Load Input File

                // Create stream and export CSV data to stream
                MemoryStream ms = new MemoryStream();
                document.Worksheets[0].SaveAsCSV(ms, "\t");

                // Convert memory stream to string
                var tabSeparatedData = Encoding.UTF8.GetString(ms.ToArray());

                // Copy data to clipboard

            Console.WriteLine("Data copied to clipboard!");

Download Source Code (.zip)

Return to the previous page Explore Spreadsheet SDK