Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Export to Excel

Quote Reply
Export to Excel
When I backup/export the data, it crashes excel (with 1000 links). The excel delimeter function cannot handle the file.

Is there a way to make it easier for excel to load? I have a lot of fields (60).

How do I get the data to have one link per row?
Quote Reply
Re: [Gregorio] Export to Excel In reply to
Hi. You would probably need a simple script;

Code:
#!/usr/bin/perl

use strict;
use lib './';
use Links qw/$IN $DB $CFG/;
use Links::SiteHTML;
use GT::CGI;
use CGI::Carp qw(fatalsToBrowser);

local $SIG{__DIE__} = \&Links::fatal;

Links::init('./');

my $fields = q~Title|URL|Description|Hits|Votes~;
my $sth = $DB->table('Links')->select();
my @fields = split /|/, $fields;

open(WRITEIT,">myoutput.txt") || die $!;

print WRITEIT "$fields\n";
while (my $hit = $sth->fetchrow_hashref) {
my $back = '';
print "Writing link: $hit->{Title} \n";
foreach (@fields) {
print WRITEIT $hit->{$_} . "|";
}
}

close(WRITEIT);


print qq|\n\nDone :)|;

Just run it via Telnet/SSH, with;

cd /path/to/admin/folder
perl script.cgi

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!