cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
yoshihirok
Level 10

Tips - Get a data on Excel from PowerShell script by Microsoft Flow

I want to share a tips to get a data on Excel from PowerShell script by Microsoft Flow.

 

Summary:

When a PowerShell script run with data, add the data to Excel file on OneDrive for Business.

 

Use Scenario:

Get data on Excel from PowerShell.

 

Flow overview:
Trigger : Request - When a HTTP request is received

Action : Excel Online (Business) - Get a row

Action : Request - Response

2018-08-12 (3).png   

Trigger : Request - When a HTTP request is received

2018-08-12 (8)_LI.jpg

Enter or paste a sample JSON payload for sending from a PowerShell script

{
 "Name": "A"
}

 

Request Body JSON Schema for trigger

{
    "type": "object",
    "properties": {
        "Name": {
            "type": "string"
        }
    }
}

 

Action : Excel Online (Business) - Get a row

File is the Excel file on OneDrive for Business

Table is the Table name on Excel

Key Column is the column name for lookup a row

Key Value is the value for lookup a row

2018-08-12 (7).png

 

Action : Request - Response

Status Code is 200 for OK

Body is the value of the data from Excel

2018-08-12 (6).png

PowerShell script

$endpoint = ""
$payload = @{
"Name" ="A"
}
Invoke-RestMethod -Method Post -Uri $endpoint -Body (ConvertTo-Json $payload) -ContentType 'application/json'

Please set $endpost to HTTP POST URL of trigger.

 

PowerShell Output

Value of the Name

 

Excel file prepare before run the PowerShell script

1. Enter "Name" to A1 cell

2. Enter "Value" to B1 cell

3. Format as table

2018-08-12 (5).png   

Regards,

Yoshihiro Kawabata

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support Team
Community Support Team

Re: Tips - Get a data on Excel from PowerShell script by Microsoft Flow

Hi @yoshihirok,

 

Thanks for sharing. It is really a good way to get data on Excel from PowerShell.

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 REPLY 1
Highlighted
Community Support Team
Community Support Team

Re: Tips - Get a data on Excel from PowerShell script by Microsoft Flow

Hi @yoshihirok,

 

Thanks for sharing. It is really a good way to get data on Excel from PowerShell.

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
>