How to Get Spreadsheet ID from POST command output
Con rispostaHello! I am currently trying to reproduce the chain from the January Beverage Break session for rolling forward financial reports. I am replacing the Create Spreadsheet and Create Sheet commands because I have found that when I use these Workiva commands, I cannot access the created spreadsheet since our service user is tied to the credentials instead of myself.
I have had success with using the create spreadsheet API in the second post command to create the spreadsheet but would like to use the third POST command towards the bottom of the chain to create a sheet within that spreadsheet. However, I am unable to find a way to get the Spreadsheet ID from the previous POST command's response.
Has anyone found a solution for something like this? I have attached a screenshot of the chain and the POST command details.
-
Hi Talia, you will need to configure the Output Schema of the HTTP Request commands in order for other commands to use it's output. Assuming you're using the Platform Files Create new file endpoint, you can see an example response here https://developers.workiva.com/workiva-platform/reference/platform-createfile.
However, instead of using the HTTP Request Connector, you may want to consider creating a new Workiva Connector that uses the Client ID and Client Secret from an API Grant associated with your account. You can then use that Workiva Connector in the command for creating the Spreadsheet which will allow you to continue using the Workiva Commands rather than the HTTP Request commands.
0Hi Jeff Hickey, thanks for getting back to me on this! I implemented your suggestion for using the create file endpoint and a new response code and it worked! I am now on the last step of my chain and I am running into a different issue. I am using a POST command to overwrite sheet data using the data file output from a previous Get Sheet Data command, but I have been unsuccessful and I think it is because of the Body Text structure. Can you take a look and let me know if I am in the right direction here?
0The value of the Body Text must be JSON in the following format:
{
"values": [
[
"Row1-Column1 Data",
"Row1-Column2 Data"
],
[
"Row2-Column1 Data",
"Row2-Column2 Data"
]
]
}The Get Sheet Data command will produce a flat file that would need to be transformed into the above expected format. Alternatively, if you did decide to create an additional Workiva Connector rather than using the HTTP Requests command, you could directly pass the file output from Get Sheet Data into the Overwrite Sheet Data command. If you continue using the HTTP Request commands, it is also advisable to use the Platform Spreadsheets API endpoints.
0Jeff Hickey Thanks! Should the convert CSV to JSON command work for transforming the flat file to the needed format? My testing for this has been unsuccessful. Ideally, we would like to use the Workiva connector rather than the HTTP commands, but this chain is something that we would like to turn into a template for other users in our organization and, because of the issue we are experiencing with the service user running the chain, other users who do not have connectors set up with their credentials will not be able to use this process. Is there a way to override permissions for the spreadsheet being created in the chain or set up some type of default permission group that includes the service user and our Admin team?
0The CSV to JSON command won't build the expected JSON array. You could transform it to JSON using the CSV to JSON command and then build the JSON array with Handlebars to pass into your POST command.
0Accedi per aggiungere un commento.
Commenti
5 commenti