openrowset for excel:我们可以跳过几行吗? [英] openrowset for excel: can we skip several rows?

查看:119
本文介绍了openrowset for excel:我们可以跳过几行吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将使用以下sql从excel读取数据,但有时我需要跳过前几行.例如,实际数据从第5行开始,因此我需要跳过前4行,这样做可行吗?

I will use the following sql to read data from excel, but sometimes I need to skip first several rows. e.g the real data begins from line 5, so I need to skip the first 4 rows, is that doable?

 SELECT *
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
    'Excel 12.0;HDR=YES;Database=c:\daniel\test.xls',
    'SELECT * FROM [sheet1$]');

推荐答案

使用范围[sheet1 $ A5:Z]而不是整个工作表[sheet1 $]

Use a range [sheet1$A5:Z] instead of the entire sheet [sheet1$]

SELECT *
FROM OPENROWSET(
    'Microsoft.ACE.OLEDB.12.0',
    'Excel 12.0;HDR=YES;Database=c:\daniel\test.xls',
    'SELECT * FROM [sheet1$A5:Z]'
);

这篇关于openrowset for excel:我们可以跳过几行吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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