Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Import data from your DNN database into a Google Spreadsheet

Return to previous page

  • 4/7/2015
  • 2019 Views

Comments

2019 Views

Import data from your DNN database into a Google Spreadsheet

Last updated long time ago

Comments

Common

(Enter the content of this article below)

Advanced

 

Background

Google docs is a freeware web-based office suite offered by Google within its Google Drive service. It was formerly a storage service as well, but has since been replaced by Drive.4 It allows users to create and edit documents online while collaborating with other users live

In early March 2014, Google added "Addons" to their Google Docs platform. One of the addons in the initial launch of the store is a Email Merge by Mail Chimp addon. It's now possible to use a Google App Script that will connect to the DNN DB and grab your user database, that can then use the data against an add-on such as Mail chimp. The following script shows how to import data into a sheet and then do a mail merge with Mail Chimp.


function database_connection() {



var conn = Jdbc.getConnection("jdbc:sqlserver://IP-address:1433;" + "databaseName=DBName;user=username;password=password;");


var stmt = conn.createStatement();

stmt.setMaxRows(500);

var start = new Date();

var rs = stmt.executeQuery('select * from users');

var doc = SpreadsheetApp.getActiveSpreadsheet();

var cell = doc.getRange('a1');

var row = 0;

while (rs.next()) {

for (var col = 0; col < rs.getMetaData().getColumnCount(); col++) {

cell.offset(row, col).setValue(rs.getString(col + 1));

}

row++;

}

rs.close();

stmt.close();

conn.close();

var end = new Date();

Logger.log('Time elapsed: ' + (end.getTime() - start.getTime()));

}

  • thanks go to Dave Lalande who wrote the original forum post
Contents
No sections defined
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out