[go: nahoru, domu]

Posted by Wesley Chun (@wescpy), Developer Advocate, Google Apps

At Google I/O 2016, we launched a new Google Sheets API—click here to watch the entire announcement. The updated API includes many new features that weren’t available in previous versions, including access to functionality found in the Sheets desktop and mobile user interfaces. My latest DevByte video shows developers how to get data into and out of a Google Sheet programmatically, walking through a simple script that reads rows out of a relational database and transferring the data to a brand new Google Sheet.

Let’s take a sneak peek of the code covered in the video. Assuming that SHEETS has been established as the API service endpoint, SHEET_ID is the ID of the Sheet to write to, and data is an array with all the database rows, this is the only call developers need to make to write that raw data into the Sheet:


SHEETS.spreadsheets().values().update(spreadsheetId=SHEET_ID,
    range='A1', body=data, valueInputOption='RAW').execute()
Reading rows out of a Sheet is even easier. With SHEETS and SHEET_ID again, this is all you need to read and display those rows:
rows = SHEETS.spreadsheets().values().get(spreadsheetId=SHEET_ID,
    range='Sheet1').execute().get('values', [])
for row in rows:
    print(row)

If you’re ready to get started, take a look at the Python or other quickstarts in a variety of languages before checking out the DevByte. If you want a deeper dive into the code covered in the video, check out the post at my Python blog. Once you get going with the API, one of the challenges developers face is in constructing the JSON payload to send in API calls—the common operations samples can really help you with this. Finally, if you’re ready to get going with a meatier example, check out our JavaScript codelab where you’ll write a sample Node.js app that manages customer orders for a toy company, the database of which is used in this DevByte, preparing you for the codelab.

We hope all these resources help developers create amazing applications and awesome tools with the new Google Sheets API! Please subscribe to our channel, give us your feedback below, and tell us what topics you would like to see in future episodes!

Posted by Wesley Chun (@wescpy), Developer Advocate, Google Apps


 function createForm() {  
   // create & name Form  
   var item = "Speaker Information Form";  
   var form = FormApp.create(item)  
       .setTitle(item);  
   
   // single line text field  
   item = "Name, Title, Organization";  
   form.addTextItem()  
       .setTitle(item)  
       .setRequired(true);  
   
   // multi-line "text area"  
   item = "Short biography (4-6 sentences)";  
   form.addParagraphTextItem()  
       .setTitle(item)  
       .setRequired(true);  
   
   // radiobuttons  
   item = "Handout format";  
   var choices = ["1-Pager", "Stapled", "Soft copy (PDF)", "none"];  
   form.addMultipleChoiceItem()  
       .setTitle(item)  
       .setChoiceValues(choices)  
       .setRequired(true);  
   
   // (multiple choice) checkboxes  
   item = "Microphone preference (if any)";  
   choices = ["wireless/lapel", "handheld", "podium/stand"];  
   form.addCheckboxItem()  
       .setTitle(item)  
       .setChoiceValues(choices);  
 }  

If you’re ready to get started, you can find more information, including another intro code sample, in the Google Forms reference section of the Apps Script docs. In the video, I challenge viewers to enhance the code snippet above to read in “forms data” from an outside source such as a Google Sheet, Google Doc, or even an external database (accessible via Apps Script’s JDBC Service) to generate multiple Forms with. What are other things you can do with Forms?

One example is illustrated by this Google Docs add-on I created for users to auto-generate Google Forms from a formatted Google Doc. If you’re looking to do integration with a variety of Google services, check out this advanced Forms quickstart that uses Google Sheets, Docs, Calendar, and Gmail! Finally, Apps Script also powers add-ons for Google Forms. To learn how to write those, check out this Forms add-on quickstart.

We hope the DevByte and all these examples inspire you to create awesome tools with Google Forms, and taking the manual creation burden off your shoulders! If you’re new to the Launchpad Online developer series, we share technical content aimed at novice Google developers, as well as discuss the latest tools and features to help you build your app. Please subscribe to our channel, give us your feedback below, and tell us what topics you would like to see in future episodes!

Originally posted on Google for Work blog


For six years, the Google Apps Marketplace has helped businesses do more by being the number one source to find third-party apps and integrations that extend what they can do with Google Apps. But with hundreds of popular apps to choose from, it’s sometimes hard for customers to discover the newest and most innovative ones that will help them attain their goals. Enter New & Notable, a new section in the Google Apps Marketplace that surfaces the latest and best third-party apps and integrations for Google Apps, and the developers behind them.
Here’s a preview of some of the products highlighted this month:
  • Asana Dashboard: The new Asana Dashboard integrates with Google Sheets, allowing users to export task completion and performance information for wider tracking across teams. Read more here.
  • Hubspot CRM: With the new HubSpot CRM app, users can now log emails sent from Gmail into HubSpot with one click, and automatically sync meetings between Google Calendar and HubSpot, no matter which system they came from. Read more here.
  • Xero: With their latest integration, Xero a provider of online accounting software for small businesses lets users view Gmail messages alongside Xero transaction and activity details. Users can also save emails in Xero for reference, start a quote or invoice from within a Gmail message. Read more here.
  • Zendesk: With their latest integration, Zendesk automates the Google Apps admin tasks of forwarding support e-mails into Zendesk and listing Google users within Zendesk. Read more here.
  • Zoho People: Zoho People is a new HR management app for small businesses that lets users manage their HR portal directly from their Google Apps account, as well as add users directly to Zoho People, saving them from having to manually re-enter employee information. Read more here.

Find these apps and many more (like AppSheet, GQueues, ZipBooks, Any.Do, Infogram, and LogoMix) in New & Notable. And if you’re a developer, learn more about how you can get your apps featured on Google Apps Marketplace here.