Create table in sharepoint excel file using REST API? - excel

I am trying to create a table given a range of cells in a Sharepoint Excel file.
For this purpose I'm consulting Microsoft Graph REST API documentation in this link
However, when I try to create the table, I see that the request for "Create table" is a bit weird as it does not specify the worksheet nor the range from which I want to create the table...
Any ideas how to do this? Thank you

According to the documentation the request body has property address where the range and optional sheet name is specified.
Endpoints:
POST /me/drive/items/{id}/workbook/tables/add
POST /me/drive/root:/{item-path}:/workbook/tables/add
POST /me/drive/items/{id}/workbook/worksheets/{id|name}/tables/add
POST /me/drive/root:/{item-path}:/workbook/worksheets/{id|name}/tables/add
Request body:
{
"address": "Sheet1!A1:D5",
"hasHeaders": true
}
The example you are referencing is really weird and probably wrong (endpoint POST https://graph.microsoft.com/v1.0/me/drive/items/{item-id}/workbook/tables/{table-id}/add is wrong. You don't know the table id before creation and the request body is also wrong).
Resources:
Create table

Related

Azure Logic app - Condition action error 'The provided types object and object are not compatible'

I'm attempting to move an email to a particular inbox based on the source. I have pulled the store out and have stored it in an Azure sql table. I also then have another table with my all my inboxes.
I want to do a condition that say, if my email subject contains an inbox stored in my inboxes table, move the email to that inbox, else do nothing.
I'm new to Azure so I'm still trying to figure out the possibilities and am currently getting the error that is below.
My condition action is below:
Here I am taking each InboxName(value-item) stored in my Inboxes table and trying to find a match within my body which contains all my email data.
I can't make sense of this error though, any ideas?
I think I should specify that I want to take the output of my function which is my email content and check it for an InboxName in my Inboxes table.
Body and Value-item are data of type Object. If you need to perform a Conditon action, you need to get the value of a specific column in the table.
You can refer to the following expression:
body('Get_row_(V2)')?['<your- column-name>']
items('For_each')?['<your-column-name>']

How to duplicate a worksheet with its content with microsoft graph excel api

i'm trying to duplicate a worksheet with its content into another new one.
In origin what i have is a table and i want to copy the worksheet with the table and its content.
In programming in PHP and i'm trying this:
$sheet = $graph->createRequest('GET', $originSheet)
->setReturnType(Model\WorkbookWorksheet::class)
->execute();
$sheet->setName($worksheetName);
$graph->createRequest('POST', $sheetUrl)
->setReturnType(Model\WorkbookWorksheet::class)
->attachBody($sheet)
->execute();
But the content is not duplicated, i just get a duplicated empty worksheet.
I tried to perform a GET to retrieve the origin table of origin worksheet, something like this:
$originSheetTables = $graph->createRequest('GET', $originSheetUrl)
->setReturnType(Model\WorkbookTable::class)
->execute();
But i don't know how to use the response of this request ($originSheetTables) to add into the new worksheet. I have tried this request with this approach:
$graph->createRequest('POST', $sheetUrl.'/'.$worksheetName.'/tables/add')
->attachBody($originSheetTables[0])
->execute();
But i'm getting a 400 error: "The request URI is not valid. The segment 'add' must be the (truncated...)"
Could you help me with this?
Thanks in advance.
I don't think you can directly duplicate the whole worksheet with data in a single call but you can try a work around by first creating a worksheet and later add a table and then get data from the previous worksheet table
and then add the values as rows to the second table in second spread sheet.
If you want to have it done on a single call, you can raise a uservoice on the Microsoft Graph Uservoice Forum for this feature.

Get google sheet filter view data with api call

There's really very little code I can show here. I'm calling a google sheets spreadsheet using the api with node.js.
Within the spreadsheet, I have created a bunch of filter views. Is there a way to tell the api to call the filtered data instead of just getting all the data in the sheet.
const dataFromGoogleSheets = `https://sheets.googleapis.com/v4/spreadsheets/${
config.spreadsheetId
}/values:batchGet?ranges=${"Sheet1"}&majorDimension=ROWS&key=${
config.apiKey
}`;
UPDATE
sheets.spreadsheets.values.get(
{
spreadsheetId: "mySpreadSheetID",
filterViewId: 121321321,
title: "Filters"
}
)
You cannot fetch data from Sheets API or Google Apps Script with an active FilterView.
As #Tanaike mentioned in the comments, you can fetch the criteria from the FilterView and reprocess it on top of the data.
You can also file a Feature Request for this on the Public Issue Tracker.

How to create custom input/output functions in Microsoft graph (excel) api?

I am trying to use Microsoft graph api with excel.
I have a spreadsheet with pre-filled data and some calculations.
For Example :
Cells A1 to A10 has some data
Cell B1 is an input field
Cell C1 is an output field whose value is a functions of A:1 to A:10
and B1 ex: C1 = SUM(A1:A10)/B1
Is is possible to use Microsoft graph API(or any other api) to send the input data in the form on HTTP request parameter and get the result as the response of the request ?
An Ideal request-response would look something like :
http://path-to-workbook/path-to-response-data?parameterB1=someNumericValue
Response:
{
C1: <result of calculation>
}
Is there a way to achieve such functionality useing graph API ?
Anything similar or helpful response/resources will be appreciated.
Just use the update range api if your need simple logic, set the formula in request body to = SUM(A1:A10)/B1
If you need Complex IO processing, Graph API for excel is not intent to I/O operation except the Report now, so you need to submit an feature request in the uservoice for this.
Actually, there are a possible API in Graph(Just idea, not test this), it is the OneDrive API, while you modify the Excel file, send the data to a custom NET api service to calculate and then use the Drive api update the file

How to add variables (coming from a cell) in web queries in MS Excel 2010?

So, I have the excel sheet pulling data from web API call, which responds in xml format. I can successfully pull it, populate it, and work with it. And since it's a get call with some parameters appended to the query, I want those parameters to come from a cell in a separate sheet (in the same workbook) so that the user can change the cell instead of the query itself.
Is it possible? How do I do it? Will it make a new API call to get the data when the content of that cell is modified or does the user have to click on Refresh?
Thanks in advance!
UPDATE: I have tried to use something like this: http://finance.yahoo.com/q?s=[“symbol”, “Enter ticker symbol”] like defined here, but when I click Import, it gives me 404 and I just can't figure out how to do it.
The API call I'm making is to our Redmine machine and I'm using this Redmine API call

Resources