Create A Macro To Import Multiple CSV Files To Microsoft Access

  Рет қаралды 19,999

Jie Jenn

Jie Jenn

Күн бұрын

In this tutorial, I am going to share a VBA script to auto import CSV/TXT/Excel files to Microsoft Access Database.
So this is a script I use almost everyday when I download my KZbin analytics reports and I need to import the files to my Access database. The advantage using a script to import your data files is when you have multiple files you need to import, a single action will finish the job.
► Buy Me a Coffee? Your support is much appreciated!
-------------------------------------------------------------------------------------
☕ Paypal: www.paypal.me/...
☕ Venmo: @Jie-Jenn
💸 Join Robinhood with my link and we'll both get a free stock: join.robinhood...
► Support my channel so I can continue making free contents
---------------------------------------------------------------------------------------------------------------
🌳 Becoming a Patreon supporter: / jiejenn
🛒 By shopping on Amazon → amzn.to/2JkGeMD
🗓 Get updated on new Python videos → / madeinpython
📘 More tutorial videos on my website → LearnDataAnaly...
📺 Also check out my 2nd channel Excel channel focus on sharing Excel tips: bit.ly/3B1DjSA
✉ Business Inquiring: KZbin@LearnDataAnalysis.org
#MSAccess #ImportFiles

Пікірлер: 35
@kathylu7320
@kathylu7320 2 жыл бұрын
Thanks a lot for sharing this! It’s truly a time saver!
@jffranca2009
@jffranca2009 2 жыл бұрын
Congratulations ! It was very helpfull to me !
@personalaccount5823
@personalaccount5823 2 жыл бұрын
Hi, this is a great video. Can you please help with two points below: 1. The data would be in different sheets. I believe here only path has to be modified right? And file_name would be now sheet_name 2. While doing normal import I get options to select primary_key(I want none but by default it keeps the first column as key so i change that option every time) and select the data type which I have to set as date for some defined columns in each sheet. Is there any way to automate these? Thanks anyway, this video was helpful to me
@Try2swipe
@Try2swipe 3 жыл бұрын
Anyway to do this with xlsx? I changed "csv" to "xlsx" but it keeps showing me error 31519 saying "You cannot import this file"
@soothing_music11
@soothing_music11 Жыл бұрын
Did you find the solution
@benc7856
@benc7856 Жыл бұрын
I need to use a specific Spec when importing files. How can you utilize spec usage with this method? Great vid, thanks for this.
@noname9432
@noname9432 2 жыл бұрын
hello Jie, thanks so much , please advise if we have way to add all imported tables into 1 table with macro instead of importing them into individual table with sheet name then import them 1 by 1 I have more than 30 CSV file , it will be really appreciated and sorry for any inconvenience
@jiejenn
@jiejenn 2 жыл бұрын
Let me look into it.
@noname9432
@noname9432 2 жыл бұрын
@@jiejenn appreciated dear ❤️
@osamanasher2550
@osamanasher2550 7 ай бұрын
Great thank you very much jie
@jiejenn
@jiejenn 7 ай бұрын
👍
@osamanasher2550
@osamanasher2550 7 ай бұрын
Kindly jie are you make vidio regarding sharing access in lan or hosting in web ? Also sending sms ????
@joaovictorbarrosdasilva3020
@joaovictorbarrosdasilva3020 3 жыл бұрын
Many thanks! It's helps a lot!! Great work!
@jiejenn
@jiejenn 3 жыл бұрын
Glad the video helped!
@manjuviswam1762
@manjuviswam1762 Жыл бұрын
Thanks for this, is it possible to import files which are Pipe separated?
@jiejenn
@jiejenn Жыл бұрын
I just checked the documentation and I don't see the delimiter parameter. I will have to look into it a bit more.
@manjuviswam1762
@manjuviswam1762 Жыл бұрын
@@jiejenn Thanks for checking, I found out from another video that we can you saved specifications.
@jasminlewis9845
@jasminlewis9845 2 жыл бұрын
Can you help with a work around for the error message to store local object for importing run time error 3011 the Microsoft access database engine could not find the object…
@jiejenn
@jiejenn 2 жыл бұрын
Can you be more specific? Probably need a little more details.
@keshoweatherz8499
@keshoweatherz8499 2 жыл бұрын
Hello great video, very helpful. Unfortunately its failing to import csv with names exceeding a certain number say if the csv is saved with more than 26 characters. Any help on such ?
@jiejenn
@jiejenn 2 жыл бұрын
That's the limitation imposed by the OS, you might have to Google the solution.
@Bobo-wl6bs
@Bobo-wl6bs 2 жыл бұрын
Thanks but I tried this for a table with a date time column and unfortunately it wouldn't work. It would keep giving me an error.
@jiejenn
@jiejenn 2 жыл бұрын
Can you be more specific?
@KarinS-tk3qt
@KarinS-tk3qt 2 жыл бұрын
can you explain how can i get this tabels from access to sql by macro?
@jiejenn
@jiejenn 2 жыл бұрын
Can you be more specific?
@KarinS-tk3qt
@KarinS-tk3qt 2 жыл бұрын
@@jiejenn This macro insert multiple csv into access. Thats great , i nedd also to insert excel file. I think I found the answer. What do you think? Public Function import_data_excel() Dim report_path As String, file_name As String With Application.FileDialog(msoFileDialogFolderPicker) .Show report_path = .SelectedItems(1) End With report_path = report_path & "\" file_name = Dir(report_path & "*.xlsx*", vbDirectory) 'MsgBox file_name Do While file_name vbNullString DoCmd.TransferSpreadsheet acImportDelim, , Trim(Replace(file_name, ".xlsx", "")), report_path & file_name, True file_name = Dir Loop MsgBox "Smile-Data Imported", vbInformation End Function
@omarabbas910
@omarabbas910 2 жыл бұрын
Hi Jie the macro works amazing but i found that if i rerun the macro to import new csv files the previously loaded data gets duplicated. Is there away to avoid that
@jiejenn
@jiejenn 2 жыл бұрын
When you import a data file, you are basically performing a Union All operation. One approach to avoid duplicate records is to import the records to a temp table first, then insert the ones are not already available in the master table.
@omarabbas910
@omarabbas910 2 жыл бұрын
@@jiejenn can that be done within the vba code? Or would I have to manually do that?
@giogobronidze7788
@giogobronidze7788 3 жыл бұрын
Hello Jie, You got a new subscribe. I have a little problem, I do get the msgbox "Data loaded" but it is not loading any files i have in directory. I only see Macros and Modules but no Tables
@jiejenn
@jiejenn 3 жыл бұрын
It's hard to troubleshoot without looking at your database file physically.
@giogobronidze7788
@giogobronidze7788 3 жыл бұрын
@@jiejenn Thanks for replying, I was missing a backslash on my path
@soothing_music11
@soothing_music11 Жыл бұрын
What if we have .xlsx
@theboyholty
@theboyholty Жыл бұрын
Oops. "can't execute code in break mode"
@henrysen-opoku590
@henrysen-opoku590 Жыл бұрын
Please, zoom the video. I didn't see a thing.
Import CSV Files into Access - pt1
23:10
codekabinett.com/en
Рет қаралды 31 М.
Combine Files from a Folder with Power Query the RIGHT WAY!
10:18
MyOnlineTrainingHub
Рет қаралды 207 М.
I didn’t expect that #kindness #help #respect #heroic #leohoangviet
00:19
Делаем с Никой слово LOVE !
00:43
Привет, Я Ника!
Рет қаралды 4,5 МЛН
Transform an Access Database into a PowerApp
9:15
Sunny Eltepu
Рет қаралды 61 М.
How to use Microsoft Access - Beginner Tutorial
31:07
Kevin Stratvert
Рет қаралды 3,5 МЛН
Learn Excel MACROS in 10 Minutes Using Real World Examples
9:13
Kenji Explains
Рет қаралды 1,2 МЛН
Automated Import of Data to Microsoft Access from Excel with Just One Click
20:32
Computer Learning Zone
Рет қаралды 22 М.
Use a File Dialog in Microsoft Access
10:32
codekabinett.com/en
Рет қаралды 30 М.
I didn’t expect that #kindness #help #respect #heroic #leohoangviet
00:19