AllPaoTeam has asked for the wisdom of the Perl Monks concerning the following question:

Good morning Perl Monks, Could someone tell me how to retrieve the name of the spreadsheets, it looks like its stored as a hash array. Below is the code and what I tried to do it but it is not returning what I was hoping for:

use Net::Google::Spreadsheets; my $service = Net::Google::Spreadsheets->new( username => 'pass@gmail.com', password => 'pass' ); my @spreadsheets = $service->spreadsheets(); print "@spreadsheets\n"; my $array_ref = \@spreadsheets; print "$$array_ref[0]\n"; Here is output: Net::Google::Spreadsheets::Spreadsheet=HASH(0x4c1a068) + Net::Google::Spreadsheets::Spreadsheet=HASH(034cxh064)

Replies are listed 'Best First'.
Re: Return spreadsheet names from google
by CountZero (Bishop) on Aug 27, 2014 at 19:23 UTC
    From the example given in the documentation, Net::Google::Spreadsheets::spreadsheets returns a list of spreadsheet objects.

    my @spreadsheets = $service->spreadsheets();

    The "name" of the spreadsheet is returned by applying the title-method. At least I think so after reading the source of Net::Google::Spreadsheets::Spreadsheet. I don't have spreadsheets on Google, so I could not actually try it.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics
Re: Return spreadsheet names from google
by GotToBTru (Prior) on Aug 27, 2014 at 19:31 UTC

    You are getting a list of Net::Google::Spreadsheets::Spreadsheet objects from $service->spreadsheets(). You will want to research the available methods to access these. See Net::Google::Spreadsheets::Spreadsheet.

    1 Peter 4:10
Re: Return spreadsheet names from google
by Anonymous Monk on Aug 27, 2014 at 19:25 UTC