{"id":9004,"date":"2025-01-31T04:14:04","date_gmt":"2025-01-31T09:14:04","guid":{"rendered":"https:\/\/incust.com\/en\/?page_id=9004"},"modified":"2025-02-27T05:55:14","modified_gmt":"2025-02-27T10:55:14","slug":"fuel-price-script","status":"publish","type":"page","link":"https:\/\/incust.com\/en\/knowledgebase\/documentation\/fuel-price-script\/","title":{"rendered":"&#8220;Fuel Price&#8221; Script"},"content":{"rendered":"<div class=\"wpb-content-wrapper\">[vc_row][vc_column width=&#8221;2\/6&#8243;][vc_wp_custommenu nav_menu=&#8221;6&#8243;][\/vc_column][vc_column width=&#8221;4\/6&#8243;][mk_fancy_title size=&#8221;32&#8243; margin_bottom=&#8221;0&#8243; font_family=&#8221;none&#8221;]<b>Instructions for Setting Up and Running the &#8220;Fuel Price&#8221; Script in Google Apps Script<\/b>[\/mk_fancy_title][vc_column_text css=&#8221;.vc_custom_1738312744999{margin-bottom: 0px !important;}&#8221;]\n<h4><b>\u00a0Creating a Project<\/b><\/h4>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Please go to<\/span><a href=\"https:\/\/script.google.com\/home\/\"> <span style=\"font-weight: 400\">Google Apps Script<\/span><\/a><span style=\"font-weight: 400\">.<\/span><\/li>\n<li style=\"font-weight: 400\">Go to <b>&#8220;New project&#8221; <\/b>to create a new project.<\/li>\n<\/ol>\n[\/vc_column_text][vc_single_image image=&#8221;9005&#8243; img_size=&#8221;full&#8221; alignment=&#8221;center&#8221; css=&#8221;&#8221;][vc_column_text css=&#8221;.vc_custom_1738312868540{margin-bottom: 0px !important;}&#8221;]\n<h4><span style=\"font-weight: 400\">3. You can rename the project by clicking on <\/span><b>&#8220;Untitled project&#8221;<\/b><span style=\"font-weight: 400\">.<\/span><\/h4>\n[\/vc_column_text][vc_single_image image=&#8221;9008&#8243; img_size=&#8221;full&#8221; alignment=&#8221;center&#8221; css=&#8221;&#8221;][vc_column_text css=&#8221;.vc_custom_1738313062311{margin-bottom: 0px !important;}&#8221;]\n<h4><b>Configuring the Project<\/b><\/h4>\n<h4><span style=\"font-weight: 400\">Open the code editor and delete the contents of <\/span><b>Code.gs<\/b><span style=\"font-weight: 400\">.<\/span><\/h4>\n[\/vc_column_text][vc_single_image image=&#8221;9009&#8243; img_size=&#8221;full&#8221; alignment=&#8221;center&#8221; css=&#8221;&#8221;][vc_column_text css=&#8221;.vc_custom_1738313165690{margin-bottom: 0px !important;}&#8221;]\n<h4><span style=\"font-weight: 400\">Download to your computer and insert the main script code from the link:<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><a href=\"https:\/\/drive.google.com\/file\/d\/1K8r2n7KU1lfAGW7206pO6ffrfObP9eM-\/view?usp=drive_link\"><span style=\"font-weight: 400\">https:\/\/drive.google.com\/file\/d\/1K8r2n7KU1lfAGW7206pO6ffrfObP9eM-\/view?usp=drive_link<\/span><\/a><\/h4>\n[\/vc_column_text][vc_column_text css=&#8221;.vc_custom_1738313237100{margin-bottom: 0px !important;}&#8221;]\n<h4><b>Connecting the Drive API<\/b><\/h4>\n<ol>\n<li><span style=\"font-weight: 400\">Navigate to the <\/span><b>&#8220;Services&#8221;<\/b><span style=\"font-weight: 400\"> menu on the sidebar.<\/span><\/li>\n<\/ol>\n[\/vc_column_text][vc_single_image image=&#8221;9010&#8243; img_size=&#8221;full&#8221; alignment=&#8221;center&#8221; css=&#8221;&#8221;][vc_column_text css=&#8221;.vc_custom_1738313269136{margin-bottom: 0px !important;}&#8221;]<span style=\"font-weight: 400\">2. Click the <\/span><b>&#8220;+&#8221;<\/b><span style=\"font-weight: 400\"> icon next to <\/span><b>&#8220;Services&#8221;<\/b><span style=\"font-weight: 400\">.<\/span><\/p>\n<p><span style=\"font-weight: 400\">3. Find <\/span><b>Drive API<\/b><span style=\"font-weight: 400\"> in the list, select it, and click <\/span><b>&#8220;Add&#8221;<\/b><span style=\"font-weight: 400\">.<\/span>[\/vc_column_text][vc_single_image image=&#8221;9011&#8243; img_size=&#8221;full&#8221; alignment=&#8221;center&#8221; css=&#8221;&#8221;][vc_column_text css=&#8221;.vc_custom_1738313355787{margin-bottom: 0px !important;}&#8221;]\n<h4><b>4. Setting up the main parameters of the script<\/b><\/h4>\n<ol>\n<li><span style=\"font-weight: 400\">In the script, locate and configure the following parameters:<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><\/li>\n<\/ol>\n[\/vc_column_text][vc_single_image image=&#8221;9012&#8243; img_size=&#8221;full&#8221; alignment=&#8221;center&#8221; css=&#8221;&#8221;][vc_column_text css=&#8221;.vc_custom_1738314283233{margin-bottom: 0px !important;}&#8221;]\n<ol>\n<li>\n<ul>\n<li style=\"font-weight: 400\"><b>UPDATE_CONFIG<\/b><span style=\"font-weight: 400\">:<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><span style=\"font-weight: 400\">name<\/span><span style=\"font-weight: 400\">: Location.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">terminalApiKey<\/span><span style=\"font-weight: 400\">: Your terminal&#8217;s API key from Prime Dash Board.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">prices<\/span><span style=\"font-weight: 400\">:<\/span>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">inputName<\/span><span style=\"font-weight: 400\">: Item name in the Excel (e.g., fuel type).<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">code<\/span><span style=\"font-weight: 400\">: Article (system code in the Prime-fuel).<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\"><span style=\"font-weight: 400\">\u00a0<\/span><\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><b>NOTIFICATION_RECIPIENTS<\/b><span style=\"font-weight: 400\">: List of email addresses for notifications.<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><span style=\"font-weight: 400\">We send a notification about the script execution to one or more of your emails.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">You can add our address if you want us to receive these messages as well: logs@incust.com<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><b>API_URL<\/b><span style=\"font-weight: 400\">: API server URL. Please use for Prime-fuel: <\/span><b>https:\/\/api.prime-fuel.com\/v1\/term<\/b><\/li>\n<li style=\"font-weight: 400\"><b>SENDERS<\/b><span style=\"font-weight: 400\">: List of email addresses allowed to send files.<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><b>IMPORTANT!<\/b><span style=\"font-weight: 400\"> You must list the email addresses from which files are processed.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">This is done for security reasons to prevent an unauthorized person from sending you a file that could change your prices.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><b>LOG_FILE_NAME<\/b><span style=\"font-weight: 400\">: Log file name. Please left as it is.<\/span><\/li>\n<li style=\"font-weight: 400\"><b>OFFSET<\/b><span style=\"font-weight: 400\">: PThe time when the price should take effect:<\/span>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">inFiveMinutes<\/span><span style=\"font-weight: 400\">, <\/span><span style=\"font-weight: 400\">tomorrow<\/span><span style=\"font-weight: 400\">, <\/span><span style=\"font-weight: 400\">dayAfterTomorrow<\/span><span style=\"font-weight: 400\">, <\/span><span style=\"font-weight: 400\">inTwoDays<\/span><span style=\"font-weight: 400\">.<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n[\/vc_column_text][vc_column_text css=&#8221;.vc_custom_1738314328755{margin-bottom: 0px !important;}&#8221;]\n<h4><b>Setting Up Triggers<\/b><\/h4>\n<p><span style=\"font-weight: 400\">Open the <\/span><b>&#8220;Triggers&#8221;<\/b><span style=\"font-weight: 400\"> section on the sidebar.<\/span>[\/vc_column_text][vc_single_image image=&#8221;9013&#8243; img_size=&#8221;full&#8221; alignment=&#8221;center&#8221; css=&#8221;&#8221;][vc_column_text css=&#8221;.vc_custom_1738314396335{margin-bottom: 0px !important;}&#8221;]\n<h4><span style=\"font-weight: 400\">2. Click <\/span><b>&#8220;Add Trigger&#8221;<\/b><span style=\"font-weight: 400\">.and configure the settings:<\/span><\/h4>\n[\/vc_column_text][vc_single_image image=&#8221;9014&#8243; img_size=&#8221;full&#8221; alignment=&#8221;center&#8221; css=&#8221;&#8221;][vc_column_text css=&#8221;.vc_custom_1738314467832{margin-bottom: 0px !important;}&#8221;]\n<ul>\n<li style=\"font-weight: 400\"><b>Function to run<\/b><span style=\"font-weight: 400\">: Select <\/span><span style=\"font-weight: 400\">run<\/span><span style=\"font-weight: 400\">.<\/span><\/li>\n<li style=\"font-weight: 400\"><b>Event source<\/b><span style=\"font-weight: 400\">: Select <\/span><span style=\"font-weight: 400\">Time-driven<\/span><span style=\"font-weight: 400\">.<\/span><\/li>\n<li style=\"font-weight: 400\"><b>Type of time-based trigger<\/b><span style=\"font-weight: 400\">: e.g., <\/span><b>&#8220;Hourly&#8221;<\/b><span style=\"font-weight: 400\">.<\/span><\/li>\n<li style=\"font-weight: 400\"><b>Interval<\/b><span style=\"font-weight: 400\">: et an interval (e.g., every 30 minutes or every hour).<\/span><\/li>\n<\/ul>\n<h4><span style=\"font-weight: 400\">3. Click <\/span><b>&#8220;Save&#8221;<\/b><span style=\"font-weight: 400\">.<\/span><\/h4>\n[\/vc_column_text][vc_column_text css=&#8221;.vc_custom_1738314500592{margin-bottom: 0px !important;}&#8221;]\n<h4><b>Granting Access Permissions<\/b><\/h4>\n<ol>\n<li><span style=\"font-weight: 400\">On the first run, a window will appear saying <\/span><b>&#8220;Authorization required&#8221;<\/b><span style=\"font-weight: 400\">. Click <\/span><b>&#8220;Review permissions&#8221;<\/b><\/li>\n<\/ol>\n[\/vc_column_text][vc_single_image image=&#8221;9015&#8243; img_size=&#8221;full&#8221; alignment=&#8221;center&#8221; css=&#8221;&#8221;][vc_column_text css=&#8221;.vc_custom_1738314562901{margin-bottom: 0px !important;}&#8221;]\n<h4><span style=\"font-weight: 400\">2. Select your <\/span><b>Google account<\/b><span style=\"font-weight: 400\">.<\/span><\/h4>\n[\/vc_column_text][vc_single_image image=&#8221;9016&#8243; img_size=&#8221;full&#8221; alignment=&#8221;center&#8221; css=&#8221;&#8221;][vc_column_text css=&#8221;.vc_custom_1738314612752{margin-bottom: 0px !important;}&#8221;]\n<h4><span style=\"font-weight: 400\">3. If you see the warning <\/span><b>&#8220;Google hasn\u2019t verified this app&#8221;<\/b><span style=\"font-weight: 400\">, click:<\/span><\/h4>\n[\/vc_column_text][vc_single_image image=&#8221;9017&#8243; img_size=&#8221;full&#8221; alignment=&#8221;center&#8221; css=&#8221;&#8221;][vc_column_text css=&#8221;.vc_custom_1738314680613{margin-bottom: 0px !important;}&#8221;]\n<ul>\n<li style=\"font-weight: 400\"><b>&#8220;Advanced&#8221;<\/b><span style=\"font-weight: 400\">.<\/span><\/li>\n<li style=\"font-weight: 400\"><b>&#8220;Go to [project name] (unsafe)&#8221;<\/b>.<\/li>\n<\/ul>\n[\/vc_column_text][vc_column_text css=&#8221;.vc_custom_1738314705181{margin-bottom: 0px !important;}&#8221;]<span style=\"font-weight: 400\">4. Click <\/span><b>&#8220;Allow&#8221;<\/b><span style=\"font-weight: 400\"> to grant access.<\/span>[\/vc_column_text][vc_single_image image=&#8221;9018&#8243; img_size=&#8221;full&#8221; alignment=&#8221;center&#8221; css=&#8221;&#8221;][vc_column_text css=&#8221;.vc_custom_1738314769685{margin-bottom: 0px !important;}&#8221;]\n<h4><b>\u00a0Recommendations for Use<\/b><\/h4>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Set a trigger to run the script <\/span><b>every 30 minutes or hour<\/b><span style=\"font-weight: 400\"> to prevent inbox clutter.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">New prices are applied according to <\/span><strong>OFFSET<\/strong><span style=\"font-weight: 400\"> settings, e.g., at <\/span><b>00:01<\/b><span style=\"font-weight: 400\"> the next day in the respective timezone.<\/span><\/li>\n<\/ul>\n[\/vc_column_text][vc_column_text css=&#8221;.vc_custom_1738314791740{margin-bottom: 0px !important;}&#8221;]\n<h4><b>\u00a0Checking Price Changes<\/b><\/h4>\n<h4><span style=\"font-weight: 400\">Scheduled price changes can only be viewed in the <\/span><b>management interface<\/b><span style=\"font-weight: 400\">. Until activation, the <\/span><b>old price<\/b><span style=\"font-weight: 400\"> will be displayed.<\/span><\/h4>\n[\/vc_column_text][vc_single_image image=&#8221;9020&#8243; img_size=&#8221;full&#8221; alignment=&#8221;center&#8221; css=&#8221;&#8221;][vc_single_image image=&#8221;9019&#8243; img_size=&#8221;full&#8221; alignment=&#8221;center&#8221; css=&#8221;&#8221;][\/vc_column][\/vc_row]\n<\/div>","protected":false},"excerpt":{"rendered":"<p>[vc_row][vc_column width=&#8221;2\/6&#8243;][vc_wp_custommenu nav_menu=&#8221;6&#8243;][\/vc_column][vc_column width=&#8221;4\/6&#8243;][mk_fancy_title size=&#8221;32&#8243; margin_bottom=&#8221;0&#8243; font_family=&#8221;none&#8221;]Instructions for Setting Up and Running the &#8220;Fuel Price&#8221; Script in Google Apps Script[\/mk_fancy_title][vc_column_text css=&#8221;.vc_custom_1738312744999{margin-bottom: 0px !important;}&#8221;] \u00a0Creating a Project Please go to Google Apps Script. Go to &#8220;New project&#8221; to create a new project. [\/vc_column_text][vc_single_image image=&#8221;9005&#8243; img_size=&#8221;full&#8221; alignment=&#8221;center&#8221; css=&#8221;&#8221;][vc_column_text css=&#8221;.vc_custom_1738312868540{margin-bottom: 0px !important;}&#8221;] 3. You can rename the project [&hellip;]<\/p>\n","protected":false},"author":24,"featured_media":0,"parent":1054,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"_links":{"self":[{"href":"https:\/\/incust.com\/en\/wp-json\/wp\/v2\/pages\/9004"}],"collection":[{"href":"https:\/\/incust.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/incust.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/incust.com\/en\/wp-json\/wp\/v2\/users\/24"}],"replies":[{"embeddable":true,"href":"https:\/\/incust.com\/en\/wp-json\/wp\/v2\/comments?post=9004"}],"version-history":[{"count":5,"href":"https:\/\/incust.com\/en\/wp-json\/wp\/v2\/pages\/9004\/revisions"}],"predecessor-version":[{"id":9030,"href":"https:\/\/incust.com\/en\/wp-json\/wp\/v2\/pages\/9004\/revisions\/9030"}],"up":[{"embeddable":true,"href":"https:\/\/incust.com\/en\/wp-json\/wp\/v2\/pages\/1054"}],"wp:attachment":[{"href":"https:\/\/incust.com\/en\/wp-json\/wp\/v2\/media?parent=9004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}