跳过前三行的CSV文件(使用的DoCmd?)在MS Access跳过、文件、CSV、Access

2023-09-08 11:22:14 作者:装逼是挨揍的前兆

我要跳过一个CSV文件的前三行加载到MS Access时。默认的CSV导入不降的前三行。我想到的是写一个宏忽略前三行的。

I need to skip the first three lines of a CSV file when loading into MS Access. The default CSV import does not drop the first three lines. I am thinking of writing a macro to ignore the first three lines.

我的研究表明DoCmd对象,但其方法并不满足跌落第一个X行。

My research has shown the DoCmd object but its methods do not cater to drop the first x lines.

有什么想法?

推荐答案

的的 DoCmd.TransferText 方法需要SpecificationName作为它的一个参数。请在如何创建一个导入规格的创建和保存导入规格。

The DoCmd.TransferText method takes a SpecificationName as one of its arguments. Follow the instructions at How to Create an Import Specification to create and save an import specification.

现在进入访问选项,导航选项,显示隐藏/系统对象。您现在应该能够打开一个名为mSysIMEXSpecs表。找到前面创建的基础上SpecName列进口规范。在STARTROW栏中,输入规格更改为3(STARTROW是从零开始的)。

Now go into Access Options, Navigation Options, and show hidden/system objects. You should now be able to open a table named 'mSysIMEXSpecs'. Find the import spec you created earlier based on the SpecName column. Change the 'StartRow' column for that import spec to 3 (the StartRow is zero-based).

现在你应该可以使用DoCmd.TransferText方法传递您所创建的导入规范的名称,它会跳过你的前三行。

Now you should be able to use the DoCmd.TransferText method passing the name of the import spec you created and it will skip your first three lines.