Hi - I've been using these articles as guides for getting deals and contacts into googlesheets, but I can't find a good resource for getting all company properties into a googlesheet. I'm using this to API_URL to get the data and these internal_names to pull the data
But it's not running thorugh all of the companies (it's stopping at 250 instead of 10,000 companies) and it's not retrieving any of the data
Any help would be most appreciated! Code below:
function getCompanies() { // Authentication to Hubspot var service = getService(); var options = {headers: {'Authorization': 'Bearer ' + service.getAccessToken()}}; var numResults = 0;
// We are going to put all the date into that array, starting with the header of our sheet var data = new Array(); data.push(["name", "website"]);
var keep_going = true; var hasMore = false; var offset = 0;
while (keep_going) { var url_query = API_URL + "/companies/v2/companies/paged?property=name&property=website&limit=250&offset="+offset; var response = UrlFetchApp.fetch(url_query, options); var result = JSON.parse(response.getContentText());
@WendyGoh thanks for replying! When I type in "has-more", the code won't run:
ReferenceError: "more" is not defined. (line 133, file "Code")
I think it sees the hyphen and thinks it's a separate variable that isn't prior defined. Any other ideas? I'm not even getting the data populating into the spreadsheet for the first 250 items.