+ Reply to Thread
Results 1 to 9 of 9

Read cell from power query

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    922

    Read cell from power query

    Hello

    Rather than using this code in PQ at the beginning of the each query
    let
    Path = Excel.CurrentWorkbook(){[Name="PPath"]}[Content]{0}[Column1],
    How can I store that cell value into PQ and call it from all queries? rather than add it to all queries

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

    Cool Re: Read cell from power query

    you can use named range instead of table
    this is a very simple example where you can use query Value in every other queries

    HTH
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    922

    Re: Read cell from power query

    You are still using Table in the worksheet and call it in PQ
    I want to use the one cell named range "PPath" and save it in PQ
    then I will call it from other queries in the source step to put the dynamic path
    example
    Source = Excel.Workbook(File.Contents([PPath]), null, true)
    This what I mean, but getting error
    let
        Source = Excel.CurrentWorkbook(){[Name="PPath"]}[Content]{0}[Column1],
        Path = Source[Value]
    in
        Path
    Expression.Error: We cannot apply field access to the type Text.
    Details:
    Value=c:
    Key=Value
    Last edited by Undo; 06-24-2023 at 05:24 AM.

  4. #4
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    922

    Re: Read cell from power query

    Update:
    This will work and I can call "PPath" from all queries to get the dynamic URL
    but I have to edit the privacy settings in all PC that will use the file
    let
        Source = Excel.CurrentWorkbook(){[Name="PPath"]}[Content],
        Column1 = Source{0}[Column1]
    in
        Column1
    is that any way to do it better that changing the settings?

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

    Re: Read cell from power query

    as I said you can use named range instead of the table, read posts carefully

    you only need to change privacy settings once or ask PQ manufacturers

  6. #6
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    922

    Re: Read cell from power query

    This VBA in workbook open, will ignore privacy level for all queries and solve the problem
    Thanks
    ThisWorkbook.Queries.FastCombine = True

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

    Re: Read cell from power query

    Quote Originally Posted by Undo View Post
    This VBA
    Your choice

  8. #8
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    922

    Re: Read cell from power query

    Will it cause problems for me?

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

    Re: Read cell from power query

    I don't know, I just hate VBA, that's all

+ 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 - Feeding dynamic sheet name to Power query
    By egoosen3 in forum Excel General
    Replies: 5
    Last Post: 09-13-2023, 07:41 AM
  2. Faster methods to read tables in power query
    By Undo in forum Excel General
    Replies: 0
    Last Post: 03-11-2023, 01:49 AM
  3. VB Code to Read Parameters into Power Query
    By dflak in forum Tips and Tutorials
    Replies: 1
    Last Post: 07-04-2021, 01:22 PM
  4. [SOLVED] Power Query - excel formula translation into Power Query
    By afgi in forum Excel Charting & Pivots
    Replies: 7
    Last Post: 02-19-2020, 03:38 AM
  5. Replies: 4
    Last Post: 02-17-2020, 06:03 AM
  6. 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
  7. New to Power Query Need to refence a cell for SQL query
    By BSWhipp in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-10-2018, 09:00 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