仅导入要访问的Excel文件的某些列 [英] Importing only some columns of an excel file to access

查看:57
本文介绍了仅导入要访问的Excel文件的某些列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个excel文件有15列,但我只需要4.我需要将它们拉入Access表w。 VBA。

我需要

A栏:客户,

C栏:城市,和

D栏:状态。

文件的长度可变。


我的问题是B列是我不想要的电话号码字段和什么从来没有我无法避免我的数据库为此字段创建导入错误表。

它包含各种数字和空格,因此无论我将表格设置为文本还是编号都是错误的。

我不在乎是否导入所有excel字段,或者只导入我需要的3个字段,但我需要一些方法来避免在B列上出错。


是否可以仅导入某些列?如果是这样,有没有人有代码?

我会喜欢整个文本和使用导入规格,但这是转移文本和excel你需要做TransferSpreadsheet。


我曾尝试在网上寻找答案,但不断遇到进口单一范围的人。谢谢!

I have an excel file that has 15 columns but I only need 4. I need to pull them into an Access table w. VBA.
I need
Column A: Client,
Column C: City, and
Column D: State.
The file will be of variable length.

My problem is that Column B is a phone number field that I don''t want and what ever I do I can''t avoid my database creating a import errors table for this field.
It contains a variety of numbers and spaces so I whether I have my table set to text or number they all error.
I don''t care whether I import all the excel fields, or only the 3 I need, but I need some way to not error on column B.

Is it possible to import only certain columns? If so, does anyone have the code?
I would love the whole thing to be text and use import specs, but that''s for TransferText and for excel you need to do TransferSpreadsheet.

I have tried looking on the web for the answer, but keep coming across people importing a single range. Thanks!

推荐答案

只是一个想法:将您需要的列复制粘贴到另一个工作表或工作簿(在Excel中)。然后导入。

祝你好运!
Just an idea: Copy-Paste the columns you need to another sheet or workbook (in Excel). Then import.
Good luck !


当然,它会每隔几天运行一次,而我正努力让用户不要这样做不需要调整导入文件。
For sure, but it will be run every few days and I''m trying to make it so the users don''t need to adjust the import file.


没有问题...使用PHP并从excel文件中提取数据并将其导入到您的数据库中。如果您使用cron作业,它将自动执行。
No prob... Use PHP and extract the data from the excel file and import it into ur DB. If u use cron job, it will do automatically.


这篇关于仅导入要访问的Excel文件的某些列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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