Post

2 followers Follow
0
Avatar

Podio::Importer.parse_file Question

Hi, I'm trying to import a .xlsx file into Podio via the API. In the reference, there's mention of a process_app method for php. Is the Podio::Importer.process_file method the equivalent for Ruby? Also, from the reference, i'm not sure I get how to handle the mapping between the file and Podio. Can someone provide a simple example, preferably in Ruby? Thanks.

Jorge Marques Answered

Please sign in to leave a comment.

6 comments

0
Avatar

Sorry, that specific method is not implemented in the Ruby client. (Edit: It is, see below). You can easily make the call yourself through the underlying Podio.connection object. Take a look at any of the models in the github repo to see how it's done.

I would not recommend using the Importer area for importing an Excel file, but unless you need to build something very flexible with mapping etc. - just like we already have inside Podio. It's quite complicated to setup this mapping and make the import work.

I'd recommend you parse the Excel file yourself and simply make calls to Add new item with the data you wish to insert. That should save time and give you much better control at the same time.

Casper Fabricius 0 votes
Comment actions Permalink
0
Avatar

I managed to do it with the .parse_file method present in the Ruby client. The mappings took  a bit of guess work, but everything seems to be working as expected.

Jorge Marques 0 votes
Comment actions Permalink
0
Avatar

Good job. Perhaps you would care to share a bit of your code for others that may stumble upon this thread when looking for a way to do Excel import?

Casper Fabricius 0 votes
Comment actions Permalink
0
Avatar

Sure. Assuming you have 2 columns, one of them of text and the other an app reference:

Podio::Importer.process_file(file_id, {

           app_id: app1_id,  

           mappings: [

                    {

                              field_id: app1_field_1_id,

                              value: {

                                        column_id: '1'

                              }

                    },

 

                    {              # This one is an app field type

                              field_id: app_1_field_2_id,

                              value: {

                                        app_id: app2_id ,

                                         mappings: [

                                                  {

                                                          field_id: app_2_field_1_id,

                                                          value: {

                                                                     column_id: '2'

                                                           }  

                                                  }

                                        ]   

                              }

           ]

}                       

                                                                               

Jorge Marques 0 votes
Comment actions Permalink
0
Avatar

Hello, I have a problem to import more than one column, I have a csv file, I import the first(0), but I can't import the others .
This is my code
$importResult = PodioImporter::process_app( $importFile->id, 14063765, array(
"app_id" => 14063765,
"mappings" => array(
array(
"field_id" => 107643862,
"unique" => false,//True of the values for the field is unique, false otherwise,
"value" => array(
"column_id" => "0",
"value_column_id" => 'RadarID'
)
),
array( "field_id" => 107643863,
"unique" => false,//True of the values for the field is unique, false otherwise,
"value" => array(
"column_id" => "1",
"value_column_id" => 'APN'
))
)
) );
the file is:
RadarID,APN,County,Address,City,State,Zip,Subdivision,LotNumber,Owner,OwnerFirstName,OwnerLastName,OwnerSpouseFirstName,Owner2,OwnerAddress,OwnerCity,OwnerState,OwnerZip,OwnerPhone,PrimaryResidence,PropertyType,Units,SqFt,YearBuilt,Beds,Baths,LotSize,Pool,Stories,EstimatedValue,EstimatedTotalLoanBalance,EquityPercent,AssessedValue,AssessedYear,AnnualTaxes,TaxRateArea,inForeclosure,FirstLoanLender,FirstLoanDate,FirstLoanAmount,SecondLoanLender,SecondLoanDate,SecondLoanAmount,TransferDate,TransferAmount,ListedForSale,ListingType,ListingPrice
P1057ED1,5041-036-031,LOS ANGELES,1625 EXPOSITION BLVD,LOS ANGELES,CA,90018,4014,175,"DAVIS,VELOCIA E",VELOCIA,DAVIS,,,2528 THORNGROVE CT,FAYETTEVILLE,NC,28303,,0,SFR,1,792,1923,1,1,3875,0,1,278064,0,100,95409,2015,1304,67,0,,,,,,,5/9/86,58000,0,,

Victoria Aparicio 0 votes
Comment actions Permalink