Contents tagged with Excel

  • Excel spreadsheet commands

    F1 Displays the Office Assistant or (Help > Microsoft Excel Help)

    F2 Edits the active cell, putting the cursor at the end

    F3 Displays the (Insert > Name > Paste) dialog box

    F4 Repeats the last worksheet action (Edit > Repeat)

    F5 Displays the (Edit > GoTo) dialog box

    F6 Moves to the next pane in a workbook (if the window is split)

    F7 Displays the (Tools > Spelling) dialog box

    F8 Toggles whether to extend a selection with the arrow keys

    F9 Calculates All the worksheets in All the open workbooks

    F10 Toggles the activation of the Menu Bar

    F11 Displays the (Insert > Chart) dialog box that creates a chart (on a chart sheet) using the highlighted range

    F12 Displays the (File > Save As) … more

  • How to convert excel file to CSV file

    Hello everybody,

    today I want to document a few lines of code which can help to convert excel file to CSV file with help of OLE:

    static void ConvertExcelToCsv(string excelFileName, string csvOutputFileName, int worksheetNumber = 1)

    {

        if (!File.Exists(excelFileName)) throw new FileNotFoundException(excelFileName);

        if (File.Exists(csvOutputFileName)) throw new ArgumentException("File already exists: " + csvOutputFileName);

        var connectionString =

            $"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={excelFileName};Extended Properties=\"Excel 8.0;IMEX=1;HDR=NO\"";

        var oleDbConnection = new OleDbConnection(connectionString);

        // get schema, then data

        var  … more