uppercase idproducts

43 views
Skip to first unread message

Roberta Amodio

unread,
Oct 24, 2023, 6:55:29 AM10/24/23
to Google Apps Script Community
Hello, i have this problem with a script and a supplmentary feed on merchant center.
The script works correctly but extract ID product in lower case.
On my feed product IDs are in capital letters so its impossible to associate them and update informations by supplmentary feed.
How can i update the script so that it converts product ids directly to uppercase?

Thank you so much
Roberta

Brian Pugh

unread,
Oct 24, 2023, 7:00:50 AM10/24/23
to google-apps-sc...@googlegroups.com
Can you provide an example (fake data)?


















Brian Pugh, IT/Educational Technologies



Associated Hebrew Schools | Danilack Middle School

p: 416.494.7666, | e: bp...@ahschools.com

w: www.associatedhebrewschools.com

252 Finch Ave W., Toronto, ON M2R 1M9


facebook.png twitter.png instagram.png 


This email is confidential and is intended for the above-named recipient(s) only. If you are not the intended recipient, please delete this email from your system. Any unauthorized use or disclosure of this email is prohibited.




--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/39ab14dc-8127-481a-9a20-3d8755434175n%40googlegroups.com.

Roberta Amodio

unread,
Oct 24, 2023, 7:13:26 AM10/24/23
to Google Apps Script Community
About script?
Message has been deleted

Roberta Amodio

unread,
Oct 24, 2023, 7:17:24 AM10/24/23
to Google Apps Script Community
This is the script:
var settings = {
  'spreadsheet': " ", // URL of the spreadsheet to populate
  'metrics': ['campaign.nam', 'segments.product_title', 'metrics.impressions', 'metrics.clicks', 'metrics.ctr', 'metrics.cost_micros', 'metrics.average_cpc', 'metrics.conversions', 'metrics.cost_per_conversion', 'metrics.conversions_value'], // Metrics to extract
   
};

function main() {
 
  var query30 = 'SELECT segments.product_item_id, ' + settings['metrics'].join(',') + ' FROM shopping_performance_view WHERE segments.date DURING LAST_30_DAYS'; // Get the product IDs and all metrics for shopping campaigns in the last 30 days
  var query7 = 'SELECT segments.product_item_id, ' + settings['metrics'].join(',') + ' FROM shopping_performance_view WHERE segments.date DURING LAST_7_DAYS'; // Get the product IDs and all metrics for shopping campaigns in the last 7 days
  var report30 = AdsApp.report(query30); // Download the 30-day report
  var report7 = AdsApp.report(query7); // Download the 7-day report
  var spreadsheet = SpreadsheetApp.openByUrl(settings['spreadsheet']); // Open the spreadsheet
  // If there is a sheet named "30Days", open it. Otherwise, create it.
  if(spreadsheet.getSheetByName('30Days')!=null){
    var days30 = spreadsheet.getSheetByName('30Days')
    } else {
        var days30 = spreadsheet.insertSheet('30Days');
    }
  report30.exportToSheet(days30); // Write the 30-day report to the "30Days" sheet
  SpreadsheetApp.flush();
  // If there is a sheet named "7Days", open it. Otherwise, create it.
  if(spreadsheet.getSheetByName('7Days')!=null){
    var days7 = spreadsheet.getSheetByName('7Days')
    } else {
        var days7 = spreadsheet.insertSheet('7Days');
    }
   report7.exportToSheet(days7); // Write the 7-day report to the "7Days" sheet
}

And the output for  segments.product_item_id is this: dsa945709 but in merchant center i have the same id product but in this way: DSA945709.
So the match doesnt's work :(
Reply all
Reply to author
Forward
0 new messages