Skip to content

lgiraudel/dfp-export-processor

Repository files navigation

DFP Export Processor

This project contains a script to process a DFP Export (saved as a Google Drive spreadsheet) in order to:

  • add filters on input columns
  • add "Total" & "Average" cells on output columns (based on filters choices)
  • generate a sheet per specified dimension containing one chart per output type

Installation

git clone https://github.com/lgiraudel/dfp-export-processor.git
npm install

Usage

In a spreadsheet, go to Tools > Script Editor

Script Editor

In the new window, go to Resources > Cloud platform project:

Cloud platform project

You'll be asked to set a project name. This is not important, choose anything and save. In the new modal, paste "928077908796" in input field and click "Set Project".

Set project ID

You'll be asked to confirm. Modal should then be updated with a success message:

Project ID success

Close the modal and go to File > Project properties.

Project properties

In the modal, copy the "Script ID" value:

Script ID

Edit the .clasp.json file and paste the script ID in "scriptId" parameter. You can close the "Script editor" tab, you won't need it anymore.


If this is the first time you execute the script, you'll have to configure several thing to allow CLASP (Google's command line library to communicate with Google App Script projects) to execute the script.

First, run:

npx clasp login

It will open a page in your browser asking for some autorizations. Allowing it will generate a .clasprc.json file in your home directory.

Then execute:

npx clasp open --creds

It will open a page where you should see a list of Oath 2.0 client IDs. Download the "DFP Export Processor".

OAuth credential

Move the file to the dfp-export-processor project and rename it "creds.json":

mv ~/Downloads/client_secret_928077908796-khee3hv0egg56q1951u1df6ro2i7jn7c.apps.googleusercontent.com.json creds.json

Then use following command:

npx clasp login --creds creds.json

It will create a local .clasprc.json file.

Finally, you'll have to enable Google Apps Script API in your Google Account by going to https://script.google.com/u/1/home/usersettings

Enable Google Apps Script API

Google Apps Script API enabled


Now you can execute the script:

npx clasp push && npx clasp run main -p '["Key-values"]'

When you'll be asked if you want to push and overwrite, choose "y".

TODO

[ ] wrap script with a npm command, passing it the script ID to generate the .clasp.json file.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published