+ Reply to Thread
Results 1 to 6 of 6

Excel Power Query- The headers from the CSV source table can change.

  1. #1
    Registered User
    Join Date
    03-21-2017
    Location
    Belfast
    MS-Off Ver
    OFFICE 365
    Posts
    16

    Excel Power Query- The headers from the CSV source table can change.

    Hello,

    I am using power query to present a table on excel from a CSV source file that gets updated each day by someone saving over it every morning.

    It's a simple CSV file, the headers are separated by | but they have inconsistent space between them so, the next day excel can't match the header on the table to the CSV file header.

    Is there any way to get excel to ignore the space?

    D

  2. #2
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Excel Power Query- The headers from the CSV source table can change.

    Can you attach a sample csv file?

    Go Advanced -> Manage Attachments -> Upload

  3. #3
    Registered User
    Join Date
    03-21-2017
    Location
    Belfast
    MS-Off Ver
    OFFICE 365
    Posts
    16

    Re: Excel Power Query- The headers from the CSV source table can change.

    CSV file attached
    Attached Files Attached Files

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Cool Re: Excel Power Query- The headers from the CSV source table can change.

    I assume the csv is exact the same every day (except data of course)
    so maybe try this way:
    • load csv to the PQ
    • don't change anything
    • create reference
    • transform reference as you wish

    I can't check more because of one csv. To compare minimum is two

    but what are you tryin' to achieve?
    Last edited by sandy666; 06-29-2018 at 04:36 AM.

  5. #5
    Registered User
    Join Date
    03-21-2017
    Location
    Belfast
    MS-Off Ver
    OFFICE 365
    Posts
    16

    Re: Excel Power Query- The headers from the CSV source table can change.

    The CSV file is coming from a different software, and it has a strange way of changing the formatting of the data, including the headers.

    capture1.PNG

    As you can see it the headers have spaces in them, this would be fine because I can transform reference but the problem is that next day there might be an additional space and excel can match the headers.

    I want the excel to allow the user to refresh the table daily and get the updated CSV data.

  6. #6
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Excel Power Query- The headers from the CSV source table can change.

    so next day = new csv with the same name of file, the same name of headers but contain different number of spaces?
    maybe:
    • Use headers as first row
    • trim
    • Use first row as headers

    describe whole procedure from start to the end if it possible

    you cannot transform any data before load to PQ.
    Maybe try any VBA solution which trim spaces of headers then load to PQ
    Last edited by sandy666; 06-29-2018 at 05:39 AM.

+ 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. Sub-Forum for Excel Power Tools (Power Query, Power Pivot & Power BI)
    By chullan88 in forum Suggestions for Improvement
    Replies: 10
    Last Post: 06-28-2018, 02:25 PM
  2. [SOLVED] Refresh data source (excel table) in power pivot
    By maboho93 in forum Excel Charting & Pivots
    Replies: 11
    Last Post: 06-08-2018, 04:13 AM
  3. Power Query Source vs Different PCs
    By flpneves in forum Excel General
    Replies: 1
    Last Post: 12-05-2017, 01:07 PM
  4. [SOLVED] Power Query Not loading all Rows from Source File
    By jdriscol in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-21-2017, 04:03 PM
  5. Power Query from Excel source file takes too long
    By MrChipper in forum Excel General
    Replies: 10
    Last Post: 06-28-2017, 04:47 AM
  6. Dropbox Data Host/Source for Power Query
    By mielkew27 in forum Excel General
    Replies: 0
    Last Post: 04-09-2017, 11:49 PM
  7. [SOLVED] Is there a way to add a normal excel formula to a Power Query Table
    By beaglesBuddy in forum Excel General
    Replies: 1
    Last Post: 07-09-2016, 04:30 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