Create spreadsheets & documents with PowerShell
Create a shareable spreadsheet from PowerShell using Invoke-RestMethod — ideal for IT automation, scheduled tasks, and admin scripts on Windows. Build a hashtable, convert to JSON, and POST it. The response gives you a URL to share or log.
PowerShell
$body = @{
title = "Q3 Revenue"
sheets = @(@{
rows = @(
@("Month", "Revenue", "Growth"),
@("July", 48200, "+12%")
)
})
} | ConvertTo-Json -Depth 6
$res = Invoke-RestMethod `
-Uri "https://openofficeai.com/api/v1/sheets" `
-Method Post `
-Headers @{ Authorization = "Bearer YOUR_API_KEY" } `
-ContentType "application/json" `
-Body $body
$res.urlHow to create a spreadsheet with PowerShell
- 1Build the body as a hashtable and pipe to ConvertTo-Json -Depth 6.
- 2Call Invoke-RestMethod with -Method Post and the Authorization header.
- 3Read $res.url from the parsed response.
- 4Schedule the script with Task Scheduler for recurring reports.
Why use OpenOfficeAI with PowerShell
- Native cmdlet — no modules to install.
- Perfect for Windows admin automation and reporting.
- Turn Get-* output into a shareable spreadsheet.
Frequently asked questions
Why -Depth 6 on ConvertTo-Json?
ConvertTo-Json defaults to a depth of 2, which would flatten the nested sheets/rows arrays. Setting -Depth 6 ensures the full structure serializes correctly.
How do I build rows from PowerShell objects?
Project your objects into arrays — e.g. $rows = $data | ForEach-Object { @($_.Name, $_.Value) } — and prepend a header array before assigning to rows.
Can I download the file in PowerShell?
Yes. Use Invoke-WebRequest -Uri "https://openofficeai.com/api/v1/download/$id?format=xlsx" -OutFile report.xlsx to save it directly.
Start creating documents with PowerShell
Free tier includes 500 API calls per month — no card required.