+ Reply to Thread
Results 1 to 19 of 19

Append multiple DBF files in PowerQuery

  1. #1
    Registered User
    Join Date
    12-08-2014
    Location
    Poland
    MS-Off Ver
    2013
    Posts
    87

    Append multiple DBF files in PowerQuery

    Hi,

    how can I open and append multiple dbf files in power query at once ? I can use the path: from ODBC --> select the dbf tabels --> append it in PQ, but then I also have to load all tables used to make an append. Also when I choose From folder --> define the path --> I get the source data but I can't display Binary data from Content table.

    Thanks for help !

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Append multiple DBF files in PowerQuery

    Create a function query which does the manipulation on your source table, based on Path / File parameters:

    fnGetDBF
    Please Login or Register  to view this content.

    Use this function to combine all the dbf tables in a folder:

    CombineDBFTables
    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    12-08-2014
    Location
    Poland
    MS-Off Ver
    2013
    Posts
    87

    Re: Append multiple DBF files in PowerQuery

    Olly,

    your functions probably works well but I still have a problem with drivers on my PC (here is the topic where you also try to help me) https://www.excelforum.com/excel-gen...wer-query.html.

    Now when I filled the parameter MyPath in fnGetDBF function I received the error DataSource.Error: ODBC: ERROR [IM002] [Microsoft][Driver Manager ODBC]. It's strange because when I get the DBF file by From ODBC in PQ everything works well

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Append multiple DBF files in PowerQuery

    Post your single file query which works.

  5. #5
    Registered User
    Join Date
    12-08-2014
    Location
    Poland
    MS-Off Ver
    2013
    Posts
    87

    Re: Append multiple DBF files in PowerQuery

    Please Login or Register  to view this content.

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Append multiple DBF files in PowerQuery

    It looks like this is the only change needed:

    fnGetDBF
    Please Login or Register  to view this content.
    And changing the path to yours:

    CombineDBFTables
    Please Login or Register  to view this content.
    Make sure you name the fist query "fnGetDBF".

    Better?

  7. #7
    Registered User
    Join Date
    12-08-2014
    Location
    Poland
    MS-Off Ver
    2013
    Posts
    87

    Re: Append multiple DBF files in PowerQuery

    It works but now I'm getting Formula.Firewall Error

  8. #8
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Append multiple DBF files in PowerQuery

    Quote Originally Posted by wrybel View Post
    It works but now I'm getting Formula.Firewall Error
    Post your exact queries, please. I don't get that error.

  9. #9
    Registered User
    Join Date
    12-08-2014
    Location
    Poland
    MS-Off Ver
    2013
    Posts
    87

    Re: Append multiple DBF files in PowerQuery

    Please Login or Register  to view this content.

  10. #10
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Append multiple DBF files in PowerQuery

    No, please post your QUERIES. The queries I posted don't result in that error, so I am guessing you've added / changed something in the queries.

  11. #11
    Registered User
    Join Date
    12-08-2014
    Location
    Poland
    MS-Off Ver
    2013
    Posts
    87

    Re: Append multiple DBF files in PowerQuery

    I used yours queries from post #6. Maybe I made a mistake in translation. Probably it should be translated like
    Please Login or Register  to view this content.

  12. #12
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Append multiple DBF files in PowerQuery

    Have you changed the Source line, in query "CombineDBFTables" ?

  13. #13
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Append multiple DBF files in PowerQuery

    Also - check the privacy settings for each data source. You could either ensure the privacy levels are set the same for all sources, or you could ignore the privacy levels in this workbook (fast combine).

  14. #14
    Registered User
    Join Date
    12-08-2014
    Location
    Poland
    MS-Off Ver
    2013
    Posts
    87

    Re: Append multiple DBF files in PowerQuery

    I set privacy settings for public and on the step combine tables in CombineDBFTables i receive an error
    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    12-08-2014
    Location
    Poland
    MS-Off Ver
    2013
    Posts
    87

    Re: Append multiple DBF files in PowerQuery

    Olly it works. Sorry but I didn't know that in fnGetDBF function "dsn=dbf_pliki" refers to a driver. After changing the privacy settings everythink works well. Thanks a lot !!!

  16. #16
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Append multiple DBF files in PowerQuery

    Great, glad we got it sorted!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. You can also add reputation to those who helped you. Thanks.

  17. #17
    Registered User
    Join Date
    05-20-2020
    Location
    Wisconsin, USA
    MS-Off Ver
    2016
    Posts
    2

    Re: Append multiple DBF files in PowerQuery

    Hi Olly, I have a similar issue except that I have the file with a consistent file name adjtime.dbf, but it is in a different folder for each day i.e. 05192020\adjtime.dbf, 05182020.dbf.

    I think your code in this case is similar to my problem, but the use of odbc is throwing me off because an odbc entry and folder name are a 1 to 1 correlation.

    So I resorted to an oledb call that looks like this, which works great, but I need to parameterize the folder name?

    = OleDb.DataSource("Provider=Microsoft.ACE.OLEDB.16.0;Data Source=C:\Users\jzimm\Downloads\aloha\20200519;extended properties=dBASE IV", [Query="select * from [adjtime.dbf]"])

  18. #18
    Registered User
    Join Date
    05-24-2020
    Location
    argentina
    MS-Off Ver
    office 2016
    Posts
    9

    Re: Append multiple DBF files in PowerQuery

    Good morning Olly, I am very new to this power query and I want to implement, raise multiple tables in DBF from various databases, all databases have the same tables, since each database belongs to a branch different.
    I'm reading this but I can't understand how I should put it together. Can I pass you the base query that I have of a table and would you help me adapt it to be able to raise all of them more automatically?

    From already thank you very much

    let
    Source = OleDb.DataSource("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\matiasvizzari\Documents\Lince\DPILAR\DBF\;extended properties=dBASE IV",
    [Query="select * from [ped.dbf]"])
    in
    Source

  19. #19
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Append multiple DBF files in PowerQuery

    Quote Originally Posted by matvizzari View Post
    Good morning Olly, I am very new to this power query and I want to implement, raise multiple tables in DBF from various databases, all databases have the same tables, since each database belongs to a branch different.
    I'm reading this but I can't understand how I should put it together. Can I pass you the base query that I have of a table and would you help me adapt it to be able to raise all of them more automatically?

    From already thank you very much

    let
    Source = OleDb.DataSource("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\matiasvizzari\Documents\Lince\DPILAR\DBF\;extended properties=dBASE IV",
    [Query="select * from [ped.dbf]"])
    in
    Source
    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 05-18-2017, 06:58 PM
  2. Append files from different folders
    By Sgligori in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-13-2017, 05:35 PM
  3. Append Multiple XML Files to a table in Excel
    By pritchard.ev in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-18-2016, 07:28 AM
  4. Append data from multiple excel files with respective file name
    By vijay20cbe in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-17-2014, 12:07 PM
  5. [SOLVED] Append Data to Multiple Files based upon Criteria
    By Topo in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-28-2012, 02:14 PM
  6. Append multiple csv files into master file?
    By Delta223 in forum Excel General
    Replies: 28
    Last Post: 01-30-2010, 02:49 AM
  7. Append many imported files to a worksheet
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-01-2009, 12:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1