Export a single property's sub-values (e.g. dropdowns, checkboxes)
We've conducted an internal review of properties and one of the needs was to see the values in dropdowns/checkboxes, and the only way was to manually copy out the values. Would be useful to be able to export them instead.
Also do you need an idea category of "properties"? I can't find the best category for this idea.
It would be great to have an easier way to achieve this than doing an API call. A solution where we can click a "Export Property Label" button would be ideal.
Absurd that this has been on since 2020, with a comment almost from every week asking for it, yet no reply. This seems to be a basic function, being able to export property selection lists, I am surprised that it is not even picked up by Hubspot Developers.
Hello everyone, I too have faced the challenge of obtaining the list of subvalues. I've developed a fast and scalable method that makes it accessible for virtually anyone to use without much difficulty. I'm pleased to share it with you.
Here's the procedure to use the Google Apps Script to retrieve subvalues of a property from HubSpot's API and write them to a specific sheet named "Script" in Google Sheets:
Open Google Sheets:
Go to Google Sheets and open a new or existing spreadsheet.
Access Google Apps Script Editor:
In your Google Sheets, click on "Extensions" in the menu bar.
Choose "Apps Script" from the dropdown menu. This opens the Google Apps Script editor in a new tab.
Paste the Script:
In the Google Apps Script editor, paste the provided script into the script editor window.
Update API Token:
Replace 'YOUR_HUBSPOT_API_TOKEN' in the script with your actual HubSpot API token.
Save the Script:
Click the disk icon or select "File" -> "Save" to save your script. You can give it a relevant name, like "HubSpotAPI".
Run the Script:
To run the script, click the play button (triangle icon) in the toolbar of the script editor.
If this is your first time running the script, you will be prompted to authorize the script to access your Google Sheets data. Follow the on-screen instructions to grant the necessary permissions.
Check the "Script" Sheet:
Go back to your Google Sheets document.
If the script runs successfully, it will either find or create a sheet named "Script" and write the retrieved data from HubSpot into this sheet.
Debugging (if needed):
If the script doesn't work as expected, you can view the logs by clicking on "View" -> "Logs" in the script editor. This can help you identify any issues or errors in the script.
Automate the Script (Optional):
If you wish to run this script automatically at set intervals, you can use Triggers in Google Apps Script.
Go to the script editor, click on the clock icon (current project's triggers), and set a new trigger for the function you want to automate.
This procedure allows you to interact with HubSpot's API directly from Google Sheets, automating the data retrieval and making it accessible for further analysis or reporting within your spreadsheet.
Here's the complete Google Apps Script code with comments to retrieve subvalues of a "property_name" property from a 'products' object in HubSpot's API and write them to a sheet named "Script" in Google Sheets:
// Function to retrieve subvalues of a specified property from HubSpot API function getHubSpotPropertySubValues() { // Define the object type and property name var objectType = 'products'; // The object type (e.g., 'contacts', 'deals', 'products', etc.) var propertyName = 'property_name'; // The name of the property
// Set up the headers for the API request, including the authorization token var headers = { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' };
// Define the options for the API request var options = { 'method' : 'get', 'headers' : headers, };
try { // Make the API request var response = UrlFetchApp.fetch(url, options); var json = response.getContentText(); var data = JSON.parse(json);
// Get or create the 'Script' sheet in the current spreadsheet var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); var sheet = spreadsheet.getSheetByName("Script");
// If the 'Script' sheet does not exist, create it if (!sheet) { sheet = spreadsheet.insertSheet("Script"); }
// Check if the property data has options (subvalues) and write them to the sheet if (data && data.options) { sheet.clear(); // Clear the sheet before writing new data // Loop through each option and write its label and value to the sheet data.options.forEach(function(option) { sheet.appendRow([option.label, option.value]); }); } else { Logger.log("No subvalues found for the specified property."); } } catch (error) { // Log any errors encountered during the API request Logger.log("Error when querying HubSpot API: " + error.toString()); } }
To use this script, you need to replace 'YOUR_HUBSPOT_API_TOKEN' with your actual HubSpot API token. The script will create a new sheet named "Script" if it doesn't exist and write the subvalues of the specified property into this sheet. Remember that the specific structure of the data may vary depending on the property you are querying, so you might need to adjust the script accordingly.
If you need any help or professional consultation, please feel free to contact me.
Hi Hubspot, I'm hoping to flag this issue again. It might not feel like a priority for your product team, but it doesn't appear to be too complex, even if you just give us the option after clicking "export all properties" to select the properties we want to export (similar to how you determine which columns you want to export when exporting lists) this would be great!
having just exported the full PROPERTIES list just to be able to see contents of a drop down menu and to discover it is no where near a neat list, would definitely want a better feature
Does anyone know how to retrieve the internal value for the hubspot_owner_id? Since the UserId and the internal value in the property hubspot_owner_id aren't the same values. I tried to request to /crm/v3/properties/contacts/hubspot_owner_id but it didn't work.
We've completed an internal assessment of properties, and one requirement was to view the options in dropdowns/checkboxes. Unfortunately, the only method available was to manually extract the values. It would be beneficial to have the option to export these values instead.
Additionally, do you require a specific category for the concept of "properties"? I'm having difficulty determining the most suitable category for this idea.