Imports System.Data.OleDb Public Class Form1 Private tbl As DataTable Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim csvFolder As String = "C:\temp\" Dim srcFile As String = "1.csv" Dim sb As New OleDbConnectionStringBuilder() 'sb.Provider = "Microsoft.JET.OLEDB.4.0" sb.Provider = "Microsoft.ACE.OLEDB.12.0" sb.DataSource = csvFolder sb("Extended Properties") = "Text;HDR=No;FMT=Delimited;" Using conn As New OleDbConnection(sb.ConnectionString) conn.Open() Dim s As String = "TRANSFORM SUM(F3) " _ & "SELECT F1 AS `名前` " _ & "FROM `" & srcFile & "` " _ & "GROUP BY F1 " _ & "PIVOT F2" 's &= " IN ('国語','数学','英語')" tbl = New DataTable(srcFile.Replace("."c, "#"c)) Using adp As New OleDbDataAdapter(s, conn) adp.Fill(tbl) End Using conn.Close() End Using '確認用。 DataGridView1.ReadOnly = True DataGridView1.DataSource = tbl End Sub End Class