+ Reply to Thread
Results 1 to 16 of 16

Is there an option in Power Query to import Named Ranges

Hybrid View

  1. #1
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,785

    Is there an option in Power Query to import Named Ranges

    Hi

    I am using Power Query because it does not require to open the source WB to fetch data. I am facing two problems

    1) It fetches data as a table (while I need it in a simple range)
    2) It does not (Or may be I don't know) import named ranges.

    I want to bring a complete sheet from a closed workbook along with its named ranges without opening the source book.

    Help would be greatly appreciated


    Best Regards
    Imran Bhatti
    Teach me Excel VBA

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Is there an option in Power Query to import Named Ranges

    You are using the wrong tool I'm afraid- that is not what Power Query does. You would have to actually copy the worksheet for what you want.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,785

    Re: Is there an option in Power Query to import Named Ranges

    Hi sir Don
    Thanks for reply

    The only reason to use PQ is its ability to fetch data with out opening the source workbook and nothing else.

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Is there an option in Power Query to import Named Ranges

    Yes, but it only brings data. I don't know of any way to extract the definition of a named range without opening the workbook.

  5. #5
    Forum Contributor
    Join Date
    12-16-2011
    Location
    Portland, OR
    MS-Off Ver
    Excel 2016 Preview
    Posts
    105

    Re: Is there an option in Power Query to import Named Ranges

    My understanding is that PQ can and does import Named Ranges, and this is actually a gotcha when working with PQ
    This screenshot below shows that when I go to import a workbook there are 3 things:

    - Sheet1 is just the sheet.
    - _xtnm.Print_Area is a print area that I set up.
    - MyRange is a named range

    This issue came up when a client had some weird duplicates all of a sudden. I discovered that someone had set a print area in just one of the workbooks. Thus, PQ was importing the same data twice. Named Ranges create the same problem if you aren't aware.


    GetNR.PNG

  6. #6
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Is there an option in Power Query to import Named Ranges

    It will import data from a named range but it will not replicate a worksheet including naming ranges which I think is what the OP wants.

  7. #7
    Forum Contributor
    Join Date
    12-16-2011
    Location
    Portland, OR
    MS-Off Ver
    Excel 2016 Preview
    Posts
    105

    Re: Is there an option in Power Query to import Named Ranges

    Let's see what OP responds with.

  8. #8
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,785

    Re: Is there an option in Power Query to import Named Ranges

    What I want:
    1: Get Full Data of a specific worksheet of another book (source book) to Destination Book
    2: Get all Named Ranges of the worksheet of source book to Destination Book
    3: During all this procedure, my source book should not be opened

    Now
    What PQ is offering
    Point 1
    Point 3

    What PQ is unable to do
    Point 2

    What VBA is offering
    Point 1
    Point 2

    What VBA is unable to do
    Point 3

    Hope this makes sense

    Edit:1 :By Named Ranges I mean the same Named Ranges formulas should be imported from source book. like if a Named Range is defined in source book as MyNamed Range,Referes to:=Sheet1!$A$1:$A$20, it should also appear in destination book if I press Ctrl + F3
    Last edited by ImranBhatti; 06-19-2018 at 01:10 AM.

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

    Re: Is there an option in Power Query to import Named Ranges

    Copy source file
    Paste as copy
    all three points are done without opening file

  10. #10
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,785

    Re: Is there an option in Power Query to import Named Ranges

    Hi sandy thanks

    But I have a Destination book already

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

    Re: Is there an option in Power Query to import Named Ranges

    so make a new destination
    if PQ doesn't work and VBA doesn't work
    change point of view and try alternative way

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,015

    Re: Is there an option in Power Query to import Named Ranges

    I have to agree with Sandy - why does the pre-made destination book need to be there at all if there is nothing in it? All you seem to be wanting to do is replicate an existing workbook in its entirety.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  13. #13
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,785

    Re: Is there an option in Power Query to import Named Ranges

    Simply can't change the Destination book as my Destination book is a dictator application

    and Named Ranges are necessary to run a batch process on multiple source books in a folder from my dictator application (Destination book)
    Don't worry I have alot'ov reasons for what I am sticking to.

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

    Re: Is there an option in Power Query to import Named Ranges

    You cannot import any Name with formula definition
    You can import Name if this is a range (with data or without) but in destination file it should be loaded into the sheet. If not - this Name wont exist

    as mentioned above - PQ works with data not with formula/calculation or something like that

  15. #15
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,785

    Re: Is there an option in Power Query to import Named Ranges

    Thanks for the contribution

    according to sandy I must think ov some other way so here is my workaround.if it is helpful for someone.

    I am Saving the Named Range info in every source book once for all as

    Two adjacent columns at the right of dataset named as "Name of Named Range" and "Referes to:" .Printing the names and formulas there. Getting that full sheet data to dest book with PQ (using VBA) and then recreating named ranges from those two columns(with vba)

    Not as efficient way but as for as I know ,it is the only way to get what I want.

  16. #16
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Is there an option in Power Query to import Named Ranges

    You might try using Worksheets.Add and specifying the source file as the type argument.

+ 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. Power Query import issue
    By kao in forum Excel General
    Replies: 30
    Last Post: 01-13-2018, 06:13 PM
  2. Replies: 2
    Last Post: 12-08-2017, 03:13 PM
  3. Import Named Ranges into Excel Document...HELP!!!
    By WaylettChris in forum Excel General
    Replies: 4
    Last Post: 11-30-2016, 08:48 AM
  4. [SOLVED] Option to use different named ranges in formulae
    By FCFalkirk in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-28-2016, 11:48 AM
  5. Power Query Import Binary Data Type
    By brent_milne in forum Excel General
    Replies: 0
    Last Post: 08-13-2015, 09:46 AM
  6. import Named Ranges?
    By Kop99 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-30-2009, 12:17 PM
  7. Named Ranges query
    By mikeyfear in forum Excel General
    Replies: 2
    Last Post: 05-13-2008, 06:37 AM

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