从Excel导入 - 页眉不在行1 [英] Importing from Excel - Header is not on row 1

查看:104
本文介绍了从Excel导入 - 页眉不在行1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有我缺少使用一个OleDbConnection导入Excel工作表到一个DataTable,并改变什么行头位于一些简单的方法是什么?我有HDR = YES在我的连接字符串和伟大工程时,标题是第1行,但实际上头将需要要上3行,我用下面的CommandText:

  SELECT [headercol1name],[headercol2name],[headercol3name] FROM [SHEETNAME]


解决方案

您可以指定一个范围:<一href=\"http://stackoverflow.com/questions/4572064/how-can-i-programmatically-import-excel-data-into-an-access-table\">How以编程方式Excel数据导入Access表?

SELECT * FROM [工作表Sheet1 $ A3:G65536]将只返回记录使用的范围,虽然我没有很仔细测试

Is there some simple way I am missing to import an Excel worksheet into a datatable using an OleDBConnection and change what row the header is located on? I have HDR=YES in my connection string and that works great when header is on row 1 but the header is actually going to need to be on row 3. I am using the following CommandText:

SELECT [headercol1name], [headercol2name], [headercol3name] FROM [sheetname]

解决方案

You can specify a range: How can I programmatically import Excel data into an Access table?

"SELECT * FROM [Sheet1$A3:G65536]" will only return records for used range, though I did not test very carefully.

这篇关于从Excel导入 - 页眉不在行1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆