Forum Discussion

paocohe's avatar
paocohe
Frequent Visitor
2 years ago
Solved

Display of data not right

Hi everyone!

I recently create a custom connector but I'm not sure if it's posible to use an url that already has the data in a xlsx format without getting this error

 

This is where I think it's the problem, but i'm not sure if there's a native function to just present the data as I have it on the api (xlsx format)

CCE.Contents = (url as text) =>
let
content = Web.Contents(url),
link = GetNextLink(content),
json = Json.Document(content),
table = Table.FromList(json, Splitter.SplitByNothing())
in
table meta [Next = link];

 

 

Thanks in advance 🙂

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi paocohe ,

    Please try:

    CCE.Contents = (url as text) =>
    let
        content = Web.Contents(url),
        workbook = Excel.Workbook(content),
        // Assuming there's only one sheet and you want the first table
        sheet = workbook{0}[Data],
        table = if Table.RowCount(sheet) > 0 then sheet else error "No data found"
    in
        table;

    Please note that you'll need to adjust the index to select the correct sheet from the workbook, and you may need to handle multiple sheets or named items depending on your xlsx file structure.

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi paocohe ,

    Please try:

    CCE.Contents = (url as text) =>
    let
        content = Web.Contents(url),
        workbook = Excel.Workbook(content),
        // Assuming there's only one sheet and you want the first table
        sheet = workbook{0}[Data],
        table = if Table.RowCount(sheet) > 0 then sheet else error "No data found"
    in
        table;

    Please note that you'll need to adjust the index to select the correct sheet from the workbook, and you may need to handle multiple sheets or named items depending on your xlsx file structure.

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

    • paocohe's avatar
      paocohe
      Frequent Visitor

      thanks i was able to make it work with your suggestion 🙂