cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GaëlleF
Regular Visitor

Failing to use Environment Variable in an Excel action

Hello there !

I'm quite new using Solutions and Environment variables and I am a bit stuck in a simple process :

 

What is my problem :

When trying to get the rows of an excel file, using Environment Variables, I get an error and cannot select the right excel file nor the concerned table. I get this error :

GalleF_1-1655391541369.png

which reads "The dynamic invocation request failed with error : { "error": {"code" : "invalidRequest","message":"The provided drive id appears to be malformed, or does not represent a valid drive", "innerError":{/*followed by a bunch of different ID and tokens.*/}}}

 

And I am trying to find what can work, but i am quite stuck on it.

 

What I created :

I created a solution called NextFactory_Solution.

In it, I set 3 Environment variables :

  1. FormID : a string, which will contain the ID of a MS Forms. Default value = the ID of a form I already set for dev purposes
  2. SiteURL : a database, type Site, with default value a SharePoint site from my environment, let's call it TeamSite
  3. LibraryID : a database, with the type List, dependant on the SiteURL variable. Default value : the standard Document Library on the SharePoint site.
    Here is the settings of LibraryID :
    GalleF_0-1655391375980.png

     

  4. FilePath : a string environment variable, containing the path+filename of the excel file. In this case it is set to default value "/Client/00.Factory/MyExcelFile.xlsx"

I then added an existing flow to the solution, by clicking "Add existing > automation > cloud flow > Not in dataverse".

To sum up, this flow is triggered when a new response is submitted to a form and it goes fetch the rows of a table set in a excel file stored under the Document library of my SharePoint TeamSite.

 

When the flow was added to the solution, it was easy to put the FormID environment variable in the trigger, I got no error message.

I then added the SiteURL environment variable to the Excel action, and it worked well, because Power Automate found the right document libraries by itself into the Document Library field.
The issue is when i add the variable LibraryID, Power Automate do not show me all the folder to browse under the File field.

The error I talked to you about is appearing.

 

Now, I created the FilePath variable, but the error remains, it is just triggered by the Table field :

GalleF_2-1655392068525.pngThis error is slightly different but from the same rootcause I think. It says :
Could not retrieve values. The dynamic invocation request failed with error: {
"status": 400,
"message": "Invalid request\r\nclientRequestId: 504da1d4-b657-4ce3-94b4-5451f5b3bffe\r\nserviceRequestId: 0cb5dc87-f3fd-4a39-9399-caf5d07fdb40",
"error": {
"message": "Invalid request"
},
"source": "excelonline-ncus.azconn-ncus.p.azurewebsites.net"
}.

 

 

Could you please help me to understand what i did wrong when initializing my Environment Variables ?

 

Thanks a lot !

Have a wonderful day

12 REPLIES 12

Hi,

I have the same problem. I already have the ID of the excel file, but using environment variables for the Site and Document library seems not to work.

MGprogrammer_0-1668441779899.png

 

I have the same issue.
If I do it without environment variable than it works fine

If I do it with environment variable it does not work.
If I check the raw input, and I see the drive (library) has a different GUID

 

Without environment variable

{
    "host": {
    "connectionReferenceName": "shared_excelonlinebusiness",
    "operationId": "GetItems"
    },
    "parameters": {
         "source": "https://XXXXXX.sharepoint.com/sites/RPA",
         "drive": "b!wK0B_z9fbkWxy04kzcFARcJCFeJiamNEnYxKu0pIr6jGra9duAwFSo0i_lP6sMJr",
         "file": "/SMSx_11_11_2022_10_40_19a.xlsx",
         "table": "Table1"
}
  
With environment variable
{
   "host": {
       "connectionReferenceName": "shared_excelonlinebusiness",
       "operationId": "GetItems"
   },
   "parameters": {
         "source": "https://xxxxxxxx.sharepoint.com/sites/RPA",
         "drive": "5dafadc6-0cb8-4a05-8d22-fe53fab0c26b",
        "file": "/SMSx_11_11_2022_10_40_19a.xlsx",
       "table": "Table1"
  }
}

JoseConde88
Frequent Visitor

Hola,

 

Para obtener el valor de la variable de entorno para el archivo, debes seleccionar todos los valores requeridos:

 

1.JPG

 Luego le das en inspeccionar la acción:

3.JPG

 

Y el valor que está de color amarillo sería la variable de entorno de tipo cadena para el archivo de excel.   Para obtener el valor de la tabla lo hacemos con la acción de enumerar registros:

5.JPG

Inspeccionamos la acción:

2.JPG

Y el valor de color en amarillo sería la variable de entorno de tipo cadena para la tabla del archivo de excel.

6.JPG

 Ya con todos los valores necesarios en las variables de entorno, lo reemplazamos y funciona el flujo sin problemas.

booster211
Frequent Visitor

After strugglin, pulling my hair... i found the post and discussion here.

I have exactly the same isse - it never works with environment variable neither compose or so

 

A BUG?

JoseConde88
Frequent Visitor

Follow the step by step above, that's how I solved it.

booster211
Frequent Visitor

@JoseConde88 thank you 👍

 

I am sure, the Excel Business Connector has some 'bugs' it can not handle environment variables.

We have to use the solution that you are recommending, or is used a Power Automate Action Series that reads the Drive ID

 

Solution and Discussion to this topic: Solved: Re: Get drive for Doc Library selection - Power Platform Community (microsoft.com)

 

Have a nice day 😎

TomaszPoszytek
Most Valuable Professional
Most Valuable Professional

Hi, you are all nearly there, to solve the issue. First of all, this action requires not the library reference, but the drive id which can be obtained either dynamically from graph API: Get Drive - Microsoft Graph v1.0 | Microsoft Learn or actually read from the action's "Peek code".

So first, select the library you want to get Excel data from, 

TomaszPoszytek_4-1684676036855.png

and after that, switch to "Peek view":

TomaszPoszytek_5-1684676055440.png

 

copy the "drive" value:

TomaszPoszytek_6-1684676072688.png

 

and use as a value of a "Text" env. variable, not "Data source":

TomaszPoszytek_7-1684676100603.png

 

Then use this variable as a custom value in action, to get data from the library:

TomaszPoszytek_8-1684676123365.png

 

That's it!

 

Good luck 🙂

 

Genial. Pero tengo una pregunta, ¿cómo puedo obtener estos valores utilizando contenido dinámico?

JoseConde88
Frequent Visitor

Hola, lo que explicaba en los hilos anteriores es para poder utilizar esas acciones con variables de entorno.  Me podrías dar más detalle de lo que quieres preguntarme.

En primer lugar, me gustaría agradecer tu respuesta, incluso después de tanto tiempo desde tu última interacción en este post.

Bien, mi objetivo es crear tablas en Power Automate, de forma dinámica e inteligente. O sea, NO quiero utilizar configuraciones manuales, como seleccionar el sitio, definir la carpeta, elegir el archivo y seleccionar el rango de mis datos.

 

Bueno, ya tengo casi todo listo, las variables de mis sitios, y como identificar mis archivos.

 

Pero me encontré con un error al buscar, mediante variables, la ubicación de la biblioteca de documentos (Drive ID) y creo que tendré el mismo problema con el File (File ID).

 

 

Cópia de Código JSON.jpg

 

Fue entonces cuando, buscando en internet, terminé aquí. Me ha parecido muy interesante esta solución porque no la conocía.

 

Hice una prueba usando el método "manual", seleccionando los criterios, "mostrando el código" y efectivamente los IDs están ahí.

Cópia de Código JSON (1).jpg

 

Ahora, ¿cómo lo hago, sin tener que "echar un vistazo al código" antes de mi flujo? Por favor, explícame cómo obtengo el Drive ID del código JSON a través de un Outputs.

 

Gracias!

 

 

Para obtener el Drive de manera dinámica podrías agregar un Compose después de la acción de Excel y con la siguiente expresión:

 

actions('Obter_planilhas_2')?['inputs']?['parameters']?['drive']

renanfm
Regular Visitor

Gracias

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (953)