Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This is a quick module that can export a view as a Comma Separated Values (CSV) file, or as a fake Doc (HTML table with msword header) file. It is similar to, but not the same as this extension to the 4.7 views_bonus module, but this module works in drupal 5.
Comment | File | Size | Author |
---|---|---|---|
#35 | views_export_images.tar_.gz | 2.9 KB | dalin |
#34 | csv_1.png | 358 bytes | dalin |
#33 | csv_0_0.png | 402 bytes | dalin |
#28 | MySite.png | 41.88 KB | solimeno |
#18 | views_bonus_export.module.filter_fix.txt | 5.5 KB | John Morahan |
Comments
Comment #1
wrunt CreditAttribution: wrunt commentedHere's the .info
Comment #2
appel CreditAttribution: appel commentedThanks wrunt, seems to work well for me on Drupal 5.1.
Comment #3
webchickOh this looks great! Subscribing.
Comment #4
Robardi56 CreditAttribution: Robardi56 commentedHi,
this is exactly what I was looking for, but i'm not sure how to install this ?
Should I install views bonus pack first ?
If not, should I just dump the views_bonus_export.module.txt in my module folder ? And what to do with the .info file ?
Thanks,
Brakkar
Comment #5
Boris Mann CreditAttribution: Boris Mann commentedAh, yes, this would be an excellent addition to the Views Bonus Pack
Comment #6
webchickThis did the job for us on the OSCMS site fantastically. It had a couple little bugs but nothing too major that couldn't get cleaned up in subsequent patches (exporting empty lines and the like -- could also have been something stupid I was doing).
Comment #7
dmitrig01 CreditAttribution: dmitrig01 commentedChecking this tonight. If I like it, I will commit it. :)
Comment #8
dalinIn the original module above, you need to clone a view and change it to the style "Views Bonus: CSV file" or "Views Export: Doc file" and then link to that from the original view. This is not a good workflow if you want to be able to export any view. So I've added a perm for 'export views as CSV and DOC' and if the current user has access, show buttons at the bottom of every view for exporting.
Comment #9
dalinHere's the .png
Taken from serach_export.module so I'm pretty sure that it's GPL
Comment #10
dalinand a doc.png
I just made this so it's GPL
Comment #11
dmitrig01 CreditAttribution: dmitrig01 commentedI have some comments:
1) great idea
2) the permissions should be separate for doc and cvs
Comment #12
hintbw CreditAttribution: hintbw commentedI have attached an updated module with the following changes:
1. Permissions for export to CSV and DOC have been separated out
2. CSV and Doc export from existing views now supports filters as well (it didn't before)
Essentially the module will now export from any view and it will honor the currents status of any exposed filters that are set for that view. It would be great if someone could review it and if we could at least get an initial commit of this module into the views bonus back once code review has happened.
Comment #13
hintbw CreditAttribution: hintbw commentedI should add that the module I attached in #12 is an updated version of the module dalin attached in #8.
Comment #14
goose2000 CreditAttribution: goose2000 commentedUh, this is a little confusing. Is there a module package to download with code and graphics etc...
Comment #15
solimeno CreditAttribution: solimeno commentedHello everyone,
Although I'm getting in on this thread late, I do want to say "Thank You" to all for this great idea and implementation. It is a perfect fit for my application. I did run into a bit of a glitch though:
using the module code from post #12 by hintbw I encountered an error message indicating "missing argument 3" on line 161. In looking at the code (and I am a rank amateur, so bear with me) it appeared to be an issue with the $output variable. To test out my hypothesis I deleted this from line 161, leaving only two arguments. I saved the changed module and then it seemed to work fine. From a view of a full table (no filters) I can export both cvs and doc formats nicely. However, in attempting to do any filtering with a view I get a "Page not found" result.
It looks like I took a small step forward but met with limited success (fixed one thing and broke another). Can any of you help me out to fix this?
Bob
Comment #16
solimeno CreditAttribution: solimeno commentedI forgot to mention that I am currently using Drupal 4.7. Although I saw that this modules works with version 5 and is not the same as a similar one written explicitly for 4.7, I wanted to incorporate the cvs and doc button features that were developed here. As I stated in my previous post, my simple mod (deleting the $output argument from line 161) works very well with a full table view but not with a filtered view.
Comment #17
solimeno CreditAttribution: solimeno commentedSomething that would make this module even better would be improved handling of multiple value fields. I've experimented a bit this afternoon with a csv export of a record with a multiple value field (numerical data) and unfortunately all values get dumped into a single "cell" when imported into a spreadsheet.
Ideally, since this is a one->many relationship the export could output consecutive rows (obviously repeating single value vield data) for as many multiple values in a m.v. field. This is useful, for example, in compiling statistics of repetitive measurements stored in this fashion for a single experimental sample. The view is displayed nicely in Drupal and in the doc export, but the csv export is a problem if you want to work with values in a spreadsheet.
Thinking out loud: Would it be "better" (easier) to create calculated, single value fields in Drupal and then export that versus what I described above?
Comment #18
John Morahan CreditAttribution: John Morahan commentedI updated the module to fix the problems mentioned in #15 and a couple of other little things I noticed. New version attached, based on #12.
Comment #19
solimeno CreditAttribution: solimeno commentedI upgraded my development site from drupal 4.7.x to drupal 5.1, and I cannot seem to get this module to work at all. I've tried using the module code posted in #12 (that was still buggy but working in drupal 4.7.x) and also the newest code patch in #18, but I've never been able to see either version operational with the CSV and DOC buttons since the upgrade to drupal 5.1 -- the views, views_bonus, and other modules are all in drupal-5.1/sites/all/modules and I placed the views_bonus_export.module file in the views_bonus folder.
Here's the status report for my site (if this helps):
Drupal 5.1
Configuration file Protected
Cron maintenance tasks Last run 9 min 2 sec ago
You can run cron manually.
Database schema Up to date
Drupal core update status Up to date
File system Writable (private download method)
Module update status Up to date
MySQL database 5.0.32
PHP 4.4.4-8+etch3
Unicode library PHP Mbstring Extension
Web server Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/4.4.4-8+etch3 mod_perl/2.0.2 Perl/v5.8.8
Comment #20
John Morahan CreditAttribution: John Morahan commentedBoth versions work in 5.1 for me. Did you remember to add the views_bonus_export.info file?
Comment #21
goose2000 CreditAttribution: goose2000 commentedHi, have it and it installed ok me thinks on 5.1 . Um, but how do I add this to my view? I missed some instruction somewhere?
Comment #22
goose2000 CreditAttribution: goose2000 commentedOpps Sorry, just found it. ReadMe.txt eventually in the works no doubt.
It's very cool, thank you.
Comment #23
solimeno CreditAttribution: solimeno commentedOoops! I was indeed missing the .info file. Works GREAT! Thank you, John.
Comment #24
dmitrig01 CreditAttribution: dmitrig01 commentedcould you please file a *real* patch, and try to make this work with http://drupal.org/node/93868?
Comment #25
jasonwhat CreditAttribution: jasonwhat commented+1, this is a great feature and it would be best to get it into CVS there is versioning and more users testing, etc.
Comment #26
dmitrig01 CreditAttribution: dmitrig01 commentedPLEASE ATTACH A PATCH
Comment #27
emilyf CreditAttribution: emilyf commentedI have tried integrating this with my site. Installed the .info and .module files (latest). Turned on the feature and gave permissions to export/import. However, I don't see how to actually use it. I've tried it from the import/export module interface, and I've tried it from views > export. It all seems the same as it was. My understanding is that this will actually allow me to export the DATA of the view. Am I wrong? Can anyone provide further instruction as to the use of this?
Thank you.
Comment #28
solimeno CreditAttribution: solimeno commentedI've successfully used this feature on a website I developed recently and it works very well.
To actually use the export functions you need to ensure that you have the "csv.png" and "doc.png" files in your views_bonus module folder. You can download them from posts #9 and #10 above. Also be sure that the "Bonus:Views Export" box is checked in your site's admin/module page (I think you said you already did this, but it's a good idea to check).
Next, just display any view of the database that you have created for your site with the views module. You should see the two (CSV and DOC) buttons on the display. Clicking either of these will execute the export to the respective format. I've attached a screenshot to show what my site looks like ...
Comment #29
vijoy CreditAttribution: vijoy commentedI've just spent 2 days troubleshooting this so I thought I would post my experience with finally getting the CSV export working. Make sure the filenames are simply 'views_bonus_export.info' and 'views_bonus_export.module'... get rid of the the added 'filter_fix' (or any other text in future reiterations) on the end-- it seems to prevent proper operation. Hope this helps.
Comment #30
emilyf CreditAttribution: emilyf commentedThanks much (screenshot appreciated); adding the .png files to the views_bonus folder fixed it, along with making sure I moved the views csv export module/info files into that folder as well. And lastly, rename csv_0.png from above to just csv.png. That finally got it working. Thanks again for the help! Works great.
Comment #31
dmitrig01 CreditAttribution: dmitrig01 commentedOk, look guys. I an the one who's going to be committing this patch. I am getting pretty angry. This is not a support queue. I would appreciate through tests of a patch in here, as well as a patch itself. You guys are running my tolerance down.
Comment #32
dmitrig01 CreditAttribution: dmitrig01 commentedOk... I'll be nice and roll a patch, but I am expecting reviews
Comment #33
dalinas per Dimitri's request I made a new csv.png to match the styling of the doc.png.
Also note that with recent versions of Views, my original patch will show the view twice, one on top of the other. The fix is to remove the last line of the function views_bonus_export_views_post_view so that it returns nothing.
Comment #34
dalinwhoops, here's the real new csv.png
Also looks like #18 fixes the return $output problem.
Comment #35
dalinHere are new versions of the icons in a nicer font, plus an XML icon, plus a GIMP .XCF file so that anyone can tweak.
Comment #36
RobLoachI'm sticking this into the CVS. Commit 75802. If you have any other problems with is, make some new issues.
Comment #37
RobLoachdmitdrig01 requested it to be in DRUPAL-5.
Comment #38
amitaibu@ROB,
Either I miss something, but I don't see the new commit 75802 in the Version 5.x-1.x-dev (or HEAD).
It shows as Last updated: July 3, 2007 - 02:16
Comment #39
RobLoachThe last message died.... Commit 75803 puts it into DRUPAL-5. Is it working for you now?
Comment #40
amitaibuShouldn't I see this then updated here Under the views_bonus 5.x-1.x-dev?
If I'm doing something wrong, I'm sorry - I don't want to turn it into a support issue; It's only that I think there is a problem here...
Comment #41
RobLoachThe dev releases are only updated when the CVS script is run. I suggest downloading it via CVS.
Comment #42
(not verified) CreditAttribution: commentedComment #43
jason.fisher CreditAttribution: jason.fisher commentedNot going to re-open this, but using CSV export with 27,000 nodeprofile nodes resulted in "Allowed memory size .. exhausted" errors, even with the memory limit set to 544MB.
My solution is relatively simple and should be considered by anyone with a large amount of data needing export.
In views_bonus_export.module, replace this function with the code below.. (or override it if you prefer)
FYI -- I am posting this to the views_bonus support page, please discuss this patch here: http://drupal.org/node/228506
Comment #44
light-blue CreditAttribution: light-blue commentedI am using cck address, and I needed unique columns for State, Zip, etc. instead of one column including all of it. Below is how I did it. It's a horrible hack, but it works. I'm posting it here just in case it helps somebody else...
Comment #45
cybershan CreditAttribution: cybershan commentedIs it only works in "register_globals" set disabled state?
Comment #46
gregaltuna CreditAttribution: gregaltuna commentedCan/would anyone help me get to this point? I installed the bonus pack, bulk operations... but can't seem to figure out how to get the "csv, et. al" buttons at the bottom of the view. Would someone mind giving me a general step-by-step??
Comment #47
mgiffordI'm curious how transportable this method will be to D7 as well.
Comment #48
giorgio79 CreditAttribution: giorgio79 commentedThe jquery datatables plugin makes this a piece of cake
http://drupal.org/project/datatables
http://www.datatables.net/release-datatables/extras/TableTools/
Comment #49
ceci123 CreditAttribution: ceci123 commentedI need to export the search results as CSV or Doc file.
Do you think I could use this to accomplish this task?
Thanks
Ceci
Comment #50
bmango CreditAttribution: bmango commented@giorgio79 - I've installed the datatables module, which is working fine, but I don't know where the tabletools plugin folder should go to add the toolbar. Can you tell me in which directory the main TableTools folder should go? I added the "T" to the "Set sDOM Initialization Parameter" in the DataTables settings but the bar is not showing up.
Any help much appreciated.