スキップしてメイン コンテンツに移動

投稿

ラベル(Excel)が付いた投稿を表示しています

Excel VBA: Output Sheet as UTF-8 CSV

Save Excel Sheet as UTF-8 CSV file The biggest problem of Excel is that Excel does not support saving file as UTF-8 CSV format. I have googled and tried to find the solution for saving excel as UTF-8 CSV but all of them requires 2 steps - 1) saving Excel file as Unicode csv 2) Open it by text editor and save it again as UTF-8 CSV. If you are a software developer, it is easy to write Java or C# program to manipulate Excel. But it means people (non developer users) need to install or launch the application. So I have wrriten Excel VBA addin for saving Excel sheet as UTF-8 CSV file so that we can save UTF-8 excel files only using Excel. Code for saving UTF-8 CSV Okie!, here is my solution! Sme notes for the code: The code saves an active sheet to UTF-8 CSV file in temp folder. The error handring part is not robust. I have only wrriten minimum error handling. You might need to add your custome error handring. If you are okay to add BOM on the file, please remove the corresp...

C#でExcelファイルの読み書き

C#でExcelファイルを読み書きするためには、まず以下の2つの準備が必要です。 Microsoft Office (Excel)のインストール Visual Studioから「参照の追加」=> 「COM」タブからMicrosoft Excel 11 Object Libraryを追加(COMのバージョン部分は、インストールしたOfficeのバージョンに依存します) サンプルコード 以下は、実際にExcelファイルを開いて、Cellへの読み書き、sheetの追加を行うサンプルコードです。 using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Office.Interop.Excel; namespace Example { class ExcelExample { private static void RunExcelExample() { Excel.Workbook book = null; Excel.Application excel = null; try { excel = new Excel.Application(); book = excel.Workbooks.Open(@"c:\test.xls", Type.Missing, true, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, ...