Forum Discussion

dbremer's avatar
dbremer
Frequent Visitor
3 years ago
Solved

Airtable Integration - Duplicating Infinite Rows

Hi,

 

I've followed the steps at this link to integrate data from Airtable into PowerBI: https://support.airtable.com/docs/visualizing-airtable-records-in-microsoft-power-bi-power-query

 

Everything appears to go smoothly until the data gets loaded in. The table that I'm specifically trying to load into PowerBI contains 787 rows of data. When it does get loaded into PowerBI, PowerBI appears to be making infinite duplicates of each row. I did let it run for two hours and around 2 billion rows of data were uploaded. What could be causing PowerBI to do this?

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hello guys i have the solution copy past this code 

     

    let
    Pagination = List.Skip( List.Generate( () => [Page_Key = "init", Counter=0], // Start Value
    each [Page_Key] <> null, // Condition under which the next execution will happen
    each [Page_Key = try if [Counter]<1
    then ""
    else [WebCall][Value][offset]
    otherwise null, // determine the LastKey for the next execution
    WebCall = try if [Counter]<1
    then Json.Document(Web.Contents("https://api.airtable.com/v0/"&BASE_ID&"/"&TABLE_ID,[Headers=[Authorization="Bearer "&PERSONAL_ACCESS_TOKEN]]))
    else Json.Document(Web.Contents("https://api.airtable.com/v0/"&BASE_ID&"/"&TABLE_ID&"?offset="&[WebCall][Value][offset] , [Headers=[Authorization="Bearer "&PERSONAL_ACCESS_TOKEN
    ]])),// retrieve results per call
    Counter = [Counter]+1// internal counter
    ],
    each [WebCall]
    ),
    1
    ),
    #"Json2Table" = Table.RenameColumns(Table.FromList(Pagination, Splitter.SplitByNothing(), null, null, ExtraValues.Ignore),{{"Column1", "stepA.1"}}),
    #"stepA.1 développé" = Table.ExpandRecordColumn(Json2Table, "stepA.1", {"Value"}, {"Value"})
    in
    #"stepA.1 développé"

     

     

7 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Same issue for me 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hello guys i have the solution copy past this code 

     

    let
    Pagination = List.Skip( List.Generate( () => [Page_Key = "init", Counter=0], // Start Value
    each [Page_Key] <> null, // Condition under which the next execution will happen
    each [Page_Key = try if [Counter]<1
    then ""
    else [WebCall][Value][offset]
    otherwise null, // determine the LastKey for the next execution
    WebCall = try if [Counter]<1
    then Json.Document(Web.Contents("https://api.airtable.com/v0/"&BASE_ID&"/"&TABLE_ID,[Headers=[Authorization="Bearer "&PERSONAL_ACCESS_TOKEN]]))
    else Json.Document(Web.Contents("https://api.airtable.com/v0/"&BASE_ID&"/"&TABLE_ID&"?offset="&[WebCall][Value][offset] , [Headers=[Authorization="Bearer "&PERSONAL_ACCESS_TOKEN
    ]])),// retrieve results per call
    Counter = [Counter]+1// internal counter
    ],
    each [WebCall]
    ),
    1
    ),
    #"Json2Table" = Table.RenameColumns(Table.FromList(Pagination, Splitter.SplitByNothing(), null, null, ExtraValues.Ignore),{{"Column1", "stepA.1"}}),
    #"stepA.1 développé" = Table.ExpandRecordColumn(Json2Table, "stepA.1", {"Value"}, {"Value"})
    in
    #"stepA.1 développé"

     

     

    • dbremer's avatar
      dbremer
      Frequent Visitor

      Hey Urba34,

       

      I tried this code, but it did not load my data into PowerBI. Did you include everything?

      • Anonymous's avatar
        Anonymous
        Not applicable

        Yes 

        BASE_ID

        TABLE_ID

        PERSONAL_ACCESS_TOKEN 

         

        it's a parameters in Power BI like that