upload JSON from Google Drive to smartheet via api

179 views Asked by At

I am trying to have JSON files that are created by form software (Prontoforms) adn saved in a google drive, automatically insert new rows on existing sheet into Smartsheet via API. I am new to API so don't know where to start. Can anyone help

1

There are 1 answers

0
Kim Brandl On

The scenario you've described is certainly achievable. You'd need to write a script that would read the JSON files from Google Drive, and then use the Smartsheet API to add new rows in Smartsheet.

Since you're new to the API, a good starting point would be to acquaint yourself with the Smartsheet API by reviewing the documentation, starting here: http://smartsheet-platform.github.io/api-docs/#overview.

When you're ready to start coding, you might consider using the Smartsheet Java SDK to implement this integration with Smartsheet. (The SDK provides built-in functions for interacting with the Smartsheet API, so you don't have to build everything from scratch yourself.) The API Documentation contains sample code that shows how to use the Java SDK to execute any operation, including Add Row(s).

From the API Documentation:

// Set the Access Token
Token token = new Token();
token.setAccessToken("INSERT_YOUR_TOKEN_HERE");

// Use the Smartsheet Builder to create a Smartsheet
Smartsheet smartsheet = new SmartsheetBuilder().setAccessToken(token.getAccessToken()).build();

// Specify cell values for first row.
List<Cell> cellsA = new Cell.AddRowCellsBuilder().addCell(7960873114331012, true).addCell(642523719853956, "New status").build();

// Specify contents of first row.
Row rowA = new Row.AddRowBuilder().setCells(cellsA).setToBottom(true).build();

// Specify cell values for second row.
List<Cell> cellsB = new Cell.AddRowCellsBuilder().addCell(7960873114331012, true).addCell(642523719853956, "New status").build();

// Specify contents of second row.
Row rowB = new Row.AddRowBuilder().setCells(cellsB).setToBottom(true).build();

// Add rows to sheet.
smartsheet.sheetResources().rowResources().addRows(sheetId, Arrays.asList(rowA, rowB));