+ Reply to Thread
Results 1 to 9 of 9

How to update csv external data and get new columns

  1. #1
    Registered User
    Join Date
    02-06-2018
    Location
    Copenhagen, Denmark
    MS-Off Ver
    2016
    Posts
    29

    How to update csv external data and get new columns

    Hi guys,

    I have an external data source from a csv file. When I imported the csv file and the table in Excel was created there was 3 columns in the table. Now my csv file has changed and a two new columns have emerged. However when I refresh my table data the new columns are not added? Is there a way to get these new columns in my table from refreshing the data?

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,913

    Re: How to update csv external data and get new columns

    Try going into connection property.

    Check in Definition tab and update Command text.

    By default, it will list each columns selected. Change it to something like...
    Please Login or Register  to view this content.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Registered User
    Join Date
    02-06-2018
    Location
    Copenhagen, Denmark
    MS-Off Ver
    2016
    Posts
    29

    Re: How to update csv external data and get new columns

    CK76 thanks for your response. This is what I see in the definition tab:

    picture dd.JPG

    It looks the same as what you wrote?

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,913

    Re: How to update csv external data and get new columns

    Hmm, are you using Get & Transform to bring in data? If so, you'd need to take a look in the Query editor.

    If not, I'd recommend using Microsoft Access Text Driver (*.txt, *.csv) as driver, instead of OLEDB.

  5. #5
    Registered User
    Join Date
    02-06-2018
    Location
    Copenhagen, Denmark
    MS-Off Ver
    2016
    Posts
    29

    Re: How to update csv external data and get new columns

    Yes originally it was the Get & Transform I used. But for updates of the file I use the Queries and Connections "Refresh All".. What should I do in the Query Editor?

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,913

    Re: How to update csv external data and get new columns

    By default, Get & Transform should bring in any update column as is. However, there are cases where new columns may be dropped.

    Once in the query editor, check the right side panel for each applied steps. If you notice in any of those steps, if columns are dropped, you'll need to modify that step to include newly added columns.

    If having trouble, go to "Advanced Editor" view and copy M code stored there and post. I can take a look in the code and see if anything is dropping column(s).

  7. #7
    Registered User
    Join Date
    02-06-2018
    Location
    Copenhagen, Denmark
    MS-Off Ver
    2016
    Posts
    29

    Re: How to update csv external data and get new columns

    This is from the Advanced Editor:

    let
    Source = Csv.Document(File.Contents("test_ARK.csv"),[Delimiter=",", Columns=17, Encoding=65001, QuoteStyle=QuoteStyle.None]),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Source File", type text}, {"Category", type text}, {"Family", type text}, {"Type", type text}, {"Component", type text}, {"F Rating", type text}, {"A Rating", type text}, {"Value", Int64.Type}, {"Id", type text}, {"Height", type text}, {"Width", type text}, {"AFDC", Int64.Type}, {"Envelope", type text}, {"Exit", type text}, {"Finish", type text}, {"Material", type text}, {"Glazing", type text}})
    in
    #"Changed Type"

    What I can see from this is that
    - Columns = 17, this seems to be a constant value and this is NOT the case. It should change according to the columns in the CSV file

  8. #8
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,913

    Re: How to update csv external data and get new columns

    Ok, so just remove the hard coded Column value
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    02-06-2018
    Location
    Copenhagen, Denmark
    MS-Off Ver
    2016
    Posts
    29

    Re: How to update csv external data and get new columns

    Thanks! That did the trick

+ 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. External Data Update Until Last Day of Month
    By tommypkoch in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-29-2013, 02:43 PM
  2. Update external data link (webdata)
    By billydilly in forum Excel General
    Replies: 1
    Last Post: 11-22-2012, 10:55 AM
  3. Automatic Update of External Data Sources?
    By NickPDC in forum Excel General
    Replies: 2
    Last Post: 06-11-2012, 06:43 AM
  4. macro to update external data connection
    By pmcatnip in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-05-2011, 03:25 PM
  5. Update external data on to hidden sheets
    By mcinnes01 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-16-2010, 10:06 AM
  6. update external data using a macro
    By minkus in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-23-2007, 06:09 PM
  7. Update data from an external Excel spreadsheet
    By marg in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-18-2006, 09:37 AM
  8. Update Columns based on External Text file
    By iMacFlats in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-09-2005, 05:20 PM

Tags for this Thread

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