Skip to content

Instantly share code, notes, and snippets.

@brianzelip
Last active November 7, 2015 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianzelip/bd99b0aa4fbd198222b3 to your computer and use it in GitHub Desktop.
Save brianzelip/bd99b0aa4fbd198222b3 to your computer and use it in GitHub Desktop.
Convert TAGS data to json using Node.js

How to convert data in a TAGS (Twitter Archiving Google Sheet) Archive sheet to json using a Node.js CLI tool

Assumptions with these instructions:

  • you've already got your copy of the TAGS Google Spreadsheet set up working with your Twitter dev account
  • install Node.js (and its package manager NPM which allows you to quickly install modular Node packages that perform specific tasks). NPM is included when you install Node. Read how to quickly install Node on your operating system on this NPM blog post. If you don't already have Node set up, I think it's a good idea to do so because it provides a wide range of software tools that do one job well (usually). Very applicable to all sorts of needs from digital humanities, to bio informatics, to web dev and more.

  1. Open your command line and install the Node package csv2json. The following command installs the package globally so that it can be accessed on the command line.

    npm install --global csv2json
  2. Download the TAGS Archive sheet as a csv file.

  3. Run the following command to make csv2json convert the csv file to a valid json file:

    csv2json input.csv output.json

where input.csv is the path to your downloaded Archive data as csv, and output.json is the path to the json file you want to create.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment