SlideShare una empresa de Scribd logo
1 de 21
Descargar para leer sin conexión
Overview of Google
Spreadsheet API for Java


                   Nazarii Kostiv
Agenda
●   Overview
●   Authorization;
●   Work with worksheet;
●   List-based feeds;
●   Cell-based feeds;
●   Questions.
What we need to start
●   jdk 1.5 or greater;
●   gdata-java-client jars;
●   java mail API 1.4 or greater;
●   javaBeans Activation Framework.
Overview

    Creating
  spreadsheet                      Set spreadsheet
                    Authorizing
    service                        URL and name




 Get row or cell                   Get spreadsheet
                   Get worksheet
                                         feed
Authorization
SpreadsheetService service =
    new SpreadsheetService("service name"); - create spreadsheet
service

service.setUserCredentials("username", "password"); - send user
credentials
Getting spreadsheet feed
String SPREADSHEET_URL = "https://spreadsheets.google.
com/feeds/spreadsheets/private/full";
URL sheetListUrl =
    new URL(SPREADSHEET_URL);- set spreadsheer URL;

SpreadsheetQuery query = new SpreadsheetQuery(sheetListUrl);
query.setTitleQuery("Spreadsheet name"); - set spreadsheet name;

SpreadsheetFeed feed =
    service.getFeed(query, SpreadsheetFeed.class); - get spreadsheet
feed with entries.
Worksheet
List<SpreadsheetEntry> spreadsheetEntries = feed.getEntries();
SpreadsheetEntry spreadsheet = spreadsheetEntries.get(0); - get
spreadsheet



List<WorksheetEntry> worksheets =
    spreadsheetEntry.getWorksheets();
WorksheetEntry worksheet = worksheets.get(0); - get worksheet;
Worksheet info
List<WorksheetEntry> worksheets = SpreadsheetDemoUtil.
getWorksheets();
       for (WorksheetEntry worksheet : worksheets) {
            System.out.println("Worksheet name: "
                   + worksheet.getTitle().getPlainText() + ", Cols: "
                   + worksheet.getColCount() + ", Rows: "
                   + worksheet.getRowCount());
       }

Worksheet name: Worksheet 1, Cols: 20, Rows: 93
Worksheet name: Worksheet 2, Cols: 20, Rows: 50
Worksheet name: New worksheet, Cols: 20, Rows: 100
Working with worksheet
WorksheetEntry worksheet = new WorksheetEntry();
URL worksheetFeedUrl =
    spreadsheetEntry.getWorksheetFeedUrl();
insertedWorksheet = service.insert(
    worksheetFeedUrl, worksheet); - add new worksheet;
worksheetETag = insertedWorksheet.getEtag();

worksheet.setColCount(30);
worksheet.update(); - update worksheet;
Working with worksheet
 title = worksheet.getTitle().getPlainText();
 eTag = worksheet.getEtag();
 if (title.equals("New worksheet")
            && eTag.equals(worksheetETag)) {
            try {
                 worksheet.delete();
            } catch .... - delete worksheet;
List-based feeds
URL listFeedUrl = worksheetEntry.getListFeedUrl();
ListFeed feed =
    service.getFeed(listFeedUrl, ListFeed.class); - get list-based feed
with list of rows

for (ListEntry entry : feed.getEntries()) {
     System.out.println(entry.getTitle().getPlainText());
}
List based working
URL listFeedUrl = new URI(null, null,
                   worksheet.getListFeedUrl().toString(),
                   "sq=width>25 and height<175", null).toURL();
listFeed = service.getFeed(listFeedUrl, ListFeed.class);
for (ListEntry row : listFeed.getEntries()) {
             System.out.println(row.get...);
}
Add row
ListFeed listFeed = service.getFeed(listFeedUrl, ListFeed.class);
ListEntry row = new ListEntry();
        row.getCustomElements().setValueLocal("Component", "New
component");
        row.getCustomElements().setValueLocal("width", "25");
        row.getCustomElements().setValueLocal("height", "19");

row = service.insert(listFeedUrl, row); - insert new row
Delete row
ListFeed listFeed = service.getFeed(listFeedUrl, ListFeed.class);

for (ListEntry row : listFeed.getEntries()) {
             if (...) {
                   row.delete();
             }
Cell-based feeds
URL cellFeedUrl = worksheetEntry.getCellFeedUrl();
CellFeed feed =
    service.getFeed(celFeedUrl, CellFeed.class); - get cell-based feed
with list of cells

for (CellEntry cell : feed.getEntries()) {
  System.out.println(entry.getTitle().getPlainText());
}
Cell based working
URL cellFeedUrl = new URI(null, null,
                   worksheet.getCellFeedUrl().toString(),
                   "?min-row=2&min-col=4&max-col=4",
null).toURL();

CellFeed cellFeed = service.getFeed(cellFeedUrl, CellFeed.class);

for (CellEntry cell : cellFeed.getEntries()) {
             System.out.println(cell.getTitle().getPlainText();
}
Cell based working
URL cellFeedUrl = mainWorksheet.getCellFeedUrl();
        CellQuery cellQuery = new CellQuery(cellFeedUrl);

        cellQuery.setMinimumCol(2);
        cellQuery.setMaximumCol(4);
        cellQuery.setMinimumRow(4);
        cellQuery.setMaximumRow(4);
        CellFeed cellFeed = null;
        try {
              cellFeed = service.query(cellQuery, CellFeed.class);
         } catch(...)
Cell data manipulation
if (cell.getTitle().getPlainText().equals("A1")){
     cell.changeInputValueLocal("123"); - set value to cell
     cell.update();
}

.....
        cell.changeInputValueLocal("=SUM(A1:B1)"); - set cell formula
Questions?
Links
●   https://developers.google.com/google-apps/spreadsheets/
●   https://developers.google.com/google-apps/documents-list/
●   https://developers.google.com/apps-script/guide
Nazarii Kostiv
Email: nazar.kostiv@gmail.com

Más contenido relacionado

La actualidad más candente

Get database properties using power shell in sql server 2008 techrepublic
Get database properties using power shell in sql server 2008   techrepublicGet database properties using power shell in sql server 2008   techrepublic
Get database properties using power shell in sql server 2008 techrepublicKaing Menglieng
 
Indexing and Query Optimization
Indexing and Query OptimizationIndexing and Query Optimization
Indexing and Query OptimizationMongoDB
 
Indexing and Query Optimisation
Indexing and Query OptimisationIndexing and Query Optimisation
Indexing and Query OptimisationMongoDB
 
Appengine ja-night-sapporo#1 bt
Appengine ja-night-sapporo#1 btAppengine ja-night-sapporo#1 bt
Appengine ja-night-sapporo#1 btShinichi Ogawa
 
ESNext for humans - LvivJS 16 August 2014
ESNext for humans - LvivJS 16 August 2014ESNext for humans - LvivJS 16 August 2014
ESNext for humans - LvivJS 16 August 2014Jan Jongboom
 
Building Smart Async Functions For Mobile
Building Smart Async Functions For MobileBuilding Smart Async Functions For Mobile
Building Smart Async Functions For MobileGlan Thomas
 
Programming with ZooKeeper - A basic tutorial
Programming with ZooKeeper - A basic tutorialProgramming with ZooKeeper - A basic tutorial
Programming with ZooKeeper - A basic tutorialJeff Smith
 
Oracle OpenWorld 2010 - Consolidating Microsoft SQL Server Databases into an ...
Oracle OpenWorld 2010 - Consolidating Microsoft SQL Server Databases into an ...Oracle OpenWorld 2010 - Consolidating Microsoft SQL Server Databases into an ...
Oracle OpenWorld 2010 - Consolidating Microsoft SQL Server Databases into an ...djkucera
 
Hitchhiker's guide to the win8
Hitchhiker's guide to the win8Hitchhiker's guide to the win8
Hitchhiker's guide to the win8Jua Alice Kim
 
Wicket Security Presentation
Wicket Security PresentationWicket Security Presentation
Wicket Security Presentationmrmean
 
知っておきたいSpring Batch Tips
知っておきたいSpring Batch Tips知っておきたいSpring Batch Tips
知っておきたいSpring Batch Tipsikeyat
 
SPFx: Working with SharePoint Content
SPFx: Working with SharePoint ContentSPFx: Working with SharePoint Content
SPFx: Working with SharePoint ContentVladimir Medina
 

La actualidad más candente (19)

Lu solr32 34-20110912
Lu solr32 34-20110912Lu solr32 34-20110912
Lu solr32 34-20110912
 
Intro to Parse
Intro to ParseIntro to Parse
Intro to Parse
 
Get database properties using power shell in sql server 2008 techrepublic
Get database properties using power shell in sql server 2008   techrepublicGet database properties using power shell in sql server 2008   techrepublic
Get database properties using power shell in sql server 2008 techrepublic
 
Indexing and Query Optimization
Indexing and Query OptimizationIndexing and Query Optimization
Indexing and Query Optimization
 
Indexing and Query Optimisation
Indexing and Query OptimisationIndexing and Query Optimisation
Indexing and Query Optimisation
 
What's Parse
What's ParseWhat's Parse
What's Parse
 
Appengine ja-night-sapporo#1 bt
Appengine ja-night-sapporo#1 btAppengine ja-night-sapporo#1 bt
Appengine ja-night-sapporo#1 bt
 
How to Use JSON in MySQL Wrong
How to Use JSON in MySQL WrongHow to Use JSON in MySQL Wrong
How to Use JSON in MySQL Wrong
 
ESNext for humans - LvivJS 16 August 2014
ESNext for humans - LvivJS 16 August 2014ESNext for humans - LvivJS 16 August 2014
ESNext for humans - LvivJS 16 August 2014
 
Swing database(mysql)
Swing database(mysql)Swing database(mysql)
Swing database(mysql)
 
Sql-Injection
Sql-InjectionSql-Injection
Sql-Injection
 
Building Smart Async Functions For Mobile
Building Smart Async Functions For MobileBuilding Smart Async Functions For Mobile
Building Smart Async Functions For Mobile
 
Programming with ZooKeeper - A basic tutorial
Programming with ZooKeeper - A basic tutorialProgramming with ZooKeeper - A basic tutorial
Programming with ZooKeeper - A basic tutorial
 
Python database access
Python database accessPython database access
Python database access
 
Oracle OpenWorld 2010 - Consolidating Microsoft SQL Server Databases into an ...
Oracle OpenWorld 2010 - Consolidating Microsoft SQL Server Databases into an ...Oracle OpenWorld 2010 - Consolidating Microsoft SQL Server Databases into an ...
Oracle OpenWorld 2010 - Consolidating Microsoft SQL Server Databases into an ...
 
Hitchhiker's guide to the win8
Hitchhiker's guide to the win8Hitchhiker's guide to the win8
Hitchhiker's guide to the win8
 
Wicket Security Presentation
Wicket Security PresentationWicket Security Presentation
Wicket Security Presentation
 
知っておきたいSpring Batch Tips
知っておきたいSpring Batch Tips知っておきたいSpring Batch Tips
知っておきたいSpring Batch Tips
 
SPFx: Working with SharePoint Content
SPFx: Working with SharePoint ContentSPFx: Working with SharePoint Content
SPFx: Working with SharePoint Content
 

Destacado

ArcGIS Server Javascript API
ArcGIS Server Javascript APIArcGIS Server Javascript API
ArcGIS Server Javascript APIewug
 
Jan. 2009 CBN
Jan. 2009 CBNJan. 2009 CBN
Jan. 2009 CBNJohn Wong
 
Social Path Routing Optimization 1.1
Social Path Routing Optimization 1.1Social Path Routing Optimization 1.1
Social Path Routing Optimization 1.1Joel Hoffmann
 
Validating a smartphone-based pedestrian navigation system prototype - An inf...
Validating a smartphone-based pedestrian navigation system prototype - An inf...Validating a smartphone-based pedestrian navigation system prototype - An inf...
Validating a smartphone-based pedestrian navigation system prototype - An inf...Beniamino Murgante
 
An Open Source GIS System for Earthquake Early Warning and Post-Event Emergen...
An Open Source GIS System for Earthquake Early Warning and Post-Event Emergen...An Open Source GIS System for Earthquake Early Warning and Post-Event Emergen...
An Open Source GIS System for Earthquake Early Warning and Post-Event Emergen...Maurizio Pollino
 
A Multiobjective Evolutionary Algorithm for Infrastructure Location in Vehicu...
A Multiobjective Evolutionary Algorithm for Infrastructure Location in Vehicu...A Multiobjective Evolutionary Algorithm for Infrastructure Location in Vehicu...
A Multiobjective Evolutionary Algorithm for Infrastructure Location in Vehicu...Jamal Toutouh, PhD
 
Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture AppDynamics
 
Internet-enabled GIS Using Free and Open Source Tools
Internet-enabled GIS Using Free and Open Source ToolsInternet-enabled GIS Using Free and Open Source Tools
Internet-enabled GIS Using Free and Open Source ToolsJohn Reiser
 
Cisco Network Icon Library
Cisco Network Icon LibraryCisco Network Icon Library
Cisco Network Icon Librarymike_adolphs
 

Destacado (11)

ArcGIS Server Javascript API
ArcGIS Server Javascript APIArcGIS Server Javascript API
ArcGIS Server Javascript API
 
Jan. 2009 CBN
Jan. 2009 CBNJan. 2009 CBN
Jan. 2009 CBN
 
Social Path Routing Optimization 1.1
Social Path Routing Optimization 1.1Social Path Routing Optimization 1.1
Social Path Routing Optimization 1.1
 
Iirs - Overview of GIS
Iirs - Overview of GISIirs - Overview of GIS
Iirs - Overview of GIS
 
Validating a smartphone-based pedestrian navigation system prototype - An inf...
Validating a smartphone-based pedestrian navigation system prototype - An inf...Validating a smartphone-based pedestrian navigation system prototype - An inf...
Validating a smartphone-based pedestrian navigation system prototype - An inf...
 
An Open Source GIS System for Earthquake Early Warning and Post-Event Emergen...
An Open Source GIS System for Earthquake Early Warning and Post-Event Emergen...An Open Source GIS System for Earthquake Early Warning and Post-Event Emergen...
An Open Source GIS System for Earthquake Early Warning and Post-Event Emergen...
 
A Multiobjective Evolutionary Algorithm for Infrastructure Location in Vehicu...
A Multiobjective Evolutionary Algorithm for Infrastructure Location in Vehicu...A Multiobjective Evolutionary Algorithm for Infrastructure Location in Vehicu...
A Multiobjective Evolutionary Algorithm for Infrastructure Location in Vehicu...
 
Vehicle Tracking System (VTS)
Vehicle Tracking System (VTS)Vehicle Tracking System (VTS)
Vehicle Tracking System (VTS)
 
Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture
 
Internet-enabled GIS Using Free and Open Source Tools
Internet-enabled GIS Using Free and Open Source ToolsInternet-enabled GIS Using Free and Open Source Tools
Internet-enabled GIS Using Free and Open Source Tools
 
Cisco Network Icon Library
Cisco Network Icon LibraryCisco Network Icon Library
Cisco Network Icon Library
 

Similar a Overview of Google spreadsheet API for Java by Nazar Kostiv

Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...SPTechCon
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Rob Windsor
 
Introduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST APIIntroduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST APIRob Windsor
 
Jsp/Servlet
Jsp/ServletJsp/Servlet
Jsp/ServletSunil OS
 
Hibernate Query Language
Hibernate Query LanguageHibernate Query Language
Hibernate Query LanguageInnovationM
 
Selenium Webdriver with data driven framework
Selenium Webdriver with data driven frameworkSelenium Webdriver with data driven framework
Selenium Webdriver with data driven frameworkDavid Rajah Selvaraj
 
Unit testing CourseSites Apache Filter
Unit testing CourseSites Apache FilterUnit testing CourseSites Apache Filter
Unit testing CourseSites Apache FilterWayan Wira
 
第49回Php勉強会@関東 Datasource
第49回Php勉強会@関東 Datasource第49回Php勉強会@関東 Datasource
第49回Php勉強会@関東 DatasourceKaz Watanabe
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejsNick Lee
 
Testdrevet javautvikling på objektorienterte skinner
Testdrevet javautvikling på objektorienterte skinnerTestdrevet javautvikling på objektorienterte skinner
Testdrevet javautvikling på objektorienterte skinnerTruls Jørgensen
 
WP_Query, pre_get_posts, and eliminating query_posts()
WP_Query, pre_get_posts, and eliminating query_posts()WP_Query, pre_get_posts, and eliminating query_posts()
WP_Query, pre_get_posts, and eliminating query_posts()Erick Hitter
 
Tutorial on developing a Solr search component plugin
Tutorial on developing a Solr search component pluginTutorial on developing a Solr search component plugin
Tutorial on developing a Solr search component pluginsearchbox-com
 

Similar a Overview of Google spreadsheet API for Java by Nazar Kostiv (20)

Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010
 
Introduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST APIIntroduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST API
 
Servlets intro
Servlets introServlets intro
Servlets intro
 
Requery overview
Requery overviewRequery overview
Requery overview
 
SERVIET
SERVIETSERVIET
SERVIET
 
Web api's
Web api'sWeb api's
Web api's
 
Jsp/Servlet
Jsp/ServletJsp/Servlet
Jsp/Servlet
 
Apache Click
Apache ClickApache Click
Apache Click
 
Servlets
ServletsServlets
Servlets
 
Hibernate Query Language
Hibernate Query LanguageHibernate Query Language
Hibernate Query Language
 
Selenium Webdriver with data driven framework
Selenium Webdriver with data driven frameworkSelenium Webdriver with data driven framework
Selenium Webdriver with data driven framework
 
Unit testing CourseSites Apache Filter
Unit testing CourseSites Apache FilterUnit testing CourseSites Apache Filter
Unit testing CourseSites Apache Filter
 
第49回Php勉強会@関東 Datasource
第49回Php勉強会@関東 Datasource第49回Php勉強会@関東 Datasource
第49回Php勉強会@関東 Datasource
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejs
 
SQLite with UWP
SQLite with UWPSQLite with UWP
SQLite with UWP
 
AJAX.ppt
AJAX.pptAJAX.ppt
AJAX.ppt
 
Testdrevet javautvikling på objektorienterte skinner
Testdrevet javautvikling på objektorienterte skinnerTestdrevet javautvikling på objektorienterte skinner
Testdrevet javautvikling på objektorienterte skinner
 
WP_Query, pre_get_posts, and eliminating query_posts()
WP_Query, pre_get_posts, and eliminating query_posts()WP_Query, pre_get_posts, and eliminating query_posts()
WP_Query, pre_get_posts, and eliminating query_posts()
 
Tutorial on developing a Solr search component plugin
Tutorial on developing a Solr search component pluginTutorial on developing a Solr search component plugin
Tutorial on developing a Solr search component plugin
 

Más de IT Booze

Erlang - concurrency-oriented programming by Serhiy Yvtyshenko
Erlang - concurrency-oriented programming by Serhiy YvtyshenkoErlang - concurrency-oriented programming by Serhiy Yvtyshenko
Erlang - concurrency-oriented programming by Serhiy YvtyshenkoIT Booze
 
Cloud Providers: Amazon, Rackspace, Azure by Andriy Tsok
Cloud Providers: Amazon, Rackspace, Azure by Andriy TsokCloud Providers: Amazon, Rackspace, Azure by Andriy Tsok
Cloud Providers: Amazon, Rackspace, Azure by Andriy TsokIT Booze
 
Let's teach your child programming with Greenfoot by Oleg Pashkevych
Let's teach your child programming with Greenfoot by Oleg Pashkevych Let's teach your child programming with Greenfoot by Oleg Pashkevych
Let's teach your child programming with Greenfoot by Oleg Pashkevych IT Booze
 
Microsoft Dynamics CRM Overview by Anatoly Kvasnikov
Microsoft Dynamics CRM Overview by Anatoly KvasnikovMicrosoft Dynamics CRM Overview by Anatoly Kvasnikov
Microsoft Dynamics CRM Overview by Anatoly KvasnikovIT Booze
 
Windows Phone and mobile application development
Windows Phone and mobile application developmentWindows Phone and mobile application development
Windows Phone and mobile application developmentIT Booze
 
Windows 8 and Metro design applications
Windows 8 and Metro design applicationsWindows 8 and Metro design applications
Windows 8 and Metro design applicationsIT Booze
 
Introduction to mercurial
Introduction to mercurialIntroduction to mercurial
Introduction to mercurialIT Booze
 

Más de IT Booze (9)

Erlang - concurrency-oriented programming by Serhiy Yvtyshenko
Erlang - concurrency-oriented programming by Serhiy YvtyshenkoErlang - concurrency-oriented programming by Serhiy Yvtyshenko
Erlang - concurrency-oriented programming by Serhiy Yvtyshenko
 
Cloud Providers: Amazon, Rackspace, Azure by Andriy Tsok
Cloud Providers: Amazon, Rackspace, Azure by Andriy TsokCloud Providers: Amazon, Rackspace, Azure by Andriy Tsok
Cloud Providers: Amazon, Rackspace, Azure by Andriy Tsok
 
Let's teach your child programming with Greenfoot by Oleg Pashkevych
Let's teach your child programming with Greenfoot by Oleg Pashkevych Let's teach your child programming with Greenfoot by Oleg Pashkevych
Let's teach your child programming with Greenfoot by Oleg Pashkevych
 
Microsoft Dynamics CRM Overview by Anatoly Kvasnikov
Microsoft Dynamics CRM Overview by Anatoly KvasnikovMicrosoft Dynamics CRM Overview by Anatoly Kvasnikov
Microsoft Dynamics CRM Overview by Anatoly Kvasnikov
 
Windows Phone and mobile application development
Windows Phone and mobile application developmentWindows Phone and mobile application development
Windows Phone and mobile application development
 
Windows 8 and Metro design applications
Windows 8 and Metro design applicationsWindows 8 and Metro design applications
Windows 8 and Metro design applications
 
Savana
SavanaSavana
Savana
 
Introduction to mercurial
Introduction to mercurialIntroduction to mercurial
Introduction to mercurial
 
Git
GitGit
Git
 

Último

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 

Último (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Overview of Google spreadsheet API for Java by Nazar Kostiv

  • 1. Overview of Google Spreadsheet API for Java Nazarii Kostiv
  • 2. Agenda ● Overview ● Authorization; ● Work with worksheet; ● List-based feeds; ● Cell-based feeds; ● Questions.
  • 3. What we need to start ● jdk 1.5 or greater; ● gdata-java-client jars; ● java mail API 1.4 or greater; ● javaBeans Activation Framework.
  • 4. Overview Creating spreadsheet Set spreadsheet Authorizing service URL and name Get row or cell Get spreadsheet Get worksheet feed
  • 5. Authorization SpreadsheetService service = new SpreadsheetService("service name"); - create spreadsheet service service.setUserCredentials("username", "password"); - send user credentials
  • 6. Getting spreadsheet feed String SPREADSHEET_URL = "https://spreadsheets.google. com/feeds/spreadsheets/private/full"; URL sheetListUrl = new URL(SPREADSHEET_URL);- set spreadsheer URL; SpreadsheetQuery query = new SpreadsheetQuery(sheetListUrl); query.setTitleQuery("Spreadsheet name"); - set spreadsheet name; SpreadsheetFeed feed = service.getFeed(query, SpreadsheetFeed.class); - get spreadsheet feed with entries.
  • 7. Worksheet List<SpreadsheetEntry> spreadsheetEntries = feed.getEntries(); SpreadsheetEntry spreadsheet = spreadsheetEntries.get(0); - get spreadsheet List<WorksheetEntry> worksheets = spreadsheetEntry.getWorksheets(); WorksheetEntry worksheet = worksheets.get(0); - get worksheet;
  • 8. Worksheet info List<WorksheetEntry> worksheets = SpreadsheetDemoUtil. getWorksheets(); for (WorksheetEntry worksheet : worksheets) { System.out.println("Worksheet name: " + worksheet.getTitle().getPlainText() + ", Cols: " + worksheet.getColCount() + ", Rows: " + worksheet.getRowCount()); } Worksheet name: Worksheet 1, Cols: 20, Rows: 93 Worksheet name: Worksheet 2, Cols: 20, Rows: 50 Worksheet name: New worksheet, Cols: 20, Rows: 100
  • 9. Working with worksheet WorksheetEntry worksheet = new WorksheetEntry(); URL worksheetFeedUrl = spreadsheetEntry.getWorksheetFeedUrl(); insertedWorksheet = service.insert( worksheetFeedUrl, worksheet); - add new worksheet; worksheetETag = insertedWorksheet.getEtag(); worksheet.setColCount(30); worksheet.update(); - update worksheet;
  • 10. Working with worksheet title = worksheet.getTitle().getPlainText(); eTag = worksheet.getEtag(); if (title.equals("New worksheet") && eTag.equals(worksheetETag)) { try { worksheet.delete(); } catch .... - delete worksheet;
  • 11. List-based feeds URL listFeedUrl = worksheetEntry.getListFeedUrl(); ListFeed feed = service.getFeed(listFeedUrl, ListFeed.class); - get list-based feed with list of rows for (ListEntry entry : feed.getEntries()) { System.out.println(entry.getTitle().getPlainText()); }
  • 12. List based working URL listFeedUrl = new URI(null, null, worksheet.getListFeedUrl().toString(), "sq=width>25 and height<175", null).toURL(); listFeed = service.getFeed(listFeedUrl, ListFeed.class); for (ListEntry row : listFeed.getEntries()) { System.out.println(row.get...); }
  • 13. Add row ListFeed listFeed = service.getFeed(listFeedUrl, ListFeed.class); ListEntry row = new ListEntry(); row.getCustomElements().setValueLocal("Component", "New component"); row.getCustomElements().setValueLocal("width", "25"); row.getCustomElements().setValueLocal("height", "19"); row = service.insert(listFeedUrl, row); - insert new row
  • 14. Delete row ListFeed listFeed = service.getFeed(listFeedUrl, ListFeed.class); for (ListEntry row : listFeed.getEntries()) { if (...) { row.delete(); }
  • 15. Cell-based feeds URL cellFeedUrl = worksheetEntry.getCellFeedUrl(); CellFeed feed = service.getFeed(celFeedUrl, CellFeed.class); - get cell-based feed with list of cells for (CellEntry cell : feed.getEntries()) { System.out.println(entry.getTitle().getPlainText()); }
  • 16. Cell based working URL cellFeedUrl = new URI(null, null, worksheet.getCellFeedUrl().toString(), "?min-row=2&min-col=4&max-col=4", null).toURL(); CellFeed cellFeed = service.getFeed(cellFeedUrl, CellFeed.class); for (CellEntry cell : cellFeed.getEntries()) { System.out.println(cell.getTitle().getPlainText(); }
  • 17. Cell based working URL cellFeedUrl = mainWorksheet.getCellFeedUrl(); CellQuery cellQuery = new CellQuery(cellFeedUrl); cellQuery.setMinimumCol(2); cellQuery.setMaximumCol(4); cellQuery.setMinimumRow(4); cellQuery.setMaximumRow(4); CellFeed cellFeed = null; try { cellFeed = service.query(cellQuery, CellFeed.class); } catch(...)
  • 18. Cell data manipulation if (cell.getTitle().getPlainText().equals("A1")){ cell.changeInputValueLocal("123"); - set value to cell cell.update(); } ..... cell.changeInputValueLocal("=SUM(A1:B1)"); - set cell formula
  • 20. Links ● https://developers.google.com/google-apps/spreadsheets/ ● https://developers.google.com/google-apps/documents-list/ ● https://developers.google.com/apps-script/guide