SlideShare une entreprise Scribd logo
1  sur  21
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

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
 

Tendances (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
 

En vedette

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
 

En vedette (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
 

Similaire à 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
 

Similaire à 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
 

Plus 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
 

Plus 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
 

Dernier

How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 

Dernier (20)

How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 

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