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   Everyth...
  • 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é"