Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Excel -> Links

Quote Reply
Excel -> Links
Okay, I am working on a new design for my site which requires modifying the database for links since I will be moving around categories and section to different positions. I open the database with Excel, but I cannot save as a Links db format with the pipe delimeters (|). It can save with spaces, but that isn't good for me because my descriptions have spaces so I can't change the links.def. It can save with commas, but I have description with commas so the idea of search and replace is no good. What is a good way to save the database for the Links format with | to seperate the sections? Thanks for any help.
Quote Reply
Re: Excel -> Links In reply to
The only idea I have is to search and remove all , in the db before saving and then set links.def to use , as the delimiter. . . Anyone have any ideas?
Quote Reply
Re: Excel -> Links In reply to
If it were me, I'd probably do just that. Sacrifice all the , in the descriptions by removing them all. Then you can save it with the , as a delimiter and then pull it into like TextPad (http://www.textpad.com) or some other fancy text editor and run a macro to search and replace , with | thru the whole file. If you really cherish the , in your descriptions you can always make a note of the ID number and the go into the admin panel and add them back in later.

Daniel Alexander

[This message has been edited by vewdew (edited August 13, 1999).]
Quote Reply
Re: Excel -> Links In reply to
Excel can import/export tab delimited files? Set $db_delim = "\t"; and you should be able to move in between progs without too much trouble.

Cheers,

Alex
Quote Reply
Re: Excel -> Links In reply to
Do this: When you save the file, choose text (Tab delimited). Some text editors will have a special code for a tab that you can use for search and replace. Using wordpad (or notepad if you don't have a large file), select (highlight) the tab area with the mouse and "copy and paste" it to the find field--it will look like a bold pipe. Type a normal pipe in the replace field and replace all.

Voila! Save it as Links.db (or as .txt and rename to .db).

Oh...I should mention that is what the save option says in Excel97--it should be fairly similar in older versions of excel.


[This message has been edited by Brad Richardson (edited August 13, 1999).]
Quote Reply
Re: Excel -> Links In reply to
I recently moved a 5,000-plus link directory into Links 2.0. It was originally created on the Mac through a butt-ugly combination of FileMaker, Frontier, and BBEdit.

The FileMaker dbase included several variable-length (repeating) fields and a few fields longer than 256 characters. I managed to get it into Links -- adding, combining, and rearranging a number of fields -- using only Excel and a freeware DOS search/replace utility. (I used George Dinwiddie's 10-year-old XLate program, but there are dozens of them out there.)

Excel wouldn't correctly read the dbase when I exported it from FileMaker as a tab-delimited text file, so I first Xlated it to clean up the odd characters FM uses to designate repeating fields. (I also ran a few passes to clean up Mac-centric "smart quotes" and accented characters.) I then imported it into Excel and whaled away at it, re-organizing its 40-plus fields. I then exported it back as a tab-delimited file.

One caveat: Excel will add quotes to any field containing commas (and, I seem to recall, a few other punctuation marks). As a result, before exporting from Excel, I search-and-replaced all quote characters with x'FF. After exporting, I first stripped out the introduced quotes and then changed all x'FFs back to quotes.

I also had some trouble with getting Excel to export empty fields consistently, so I changed each empty field to x'FE prior to export and then stripped them out before pulling the file into Links.

I didn't think of Alex's trick with $db_delim; instead, I used Xlate one last time to replace x'09 with "|".

A quick pass with the Bulkload utility from the resource center and I was done.

(I also used a similar process to create my category.db. However, there were nearly 700 categories defined in the original site. Each category had a unique code instead of Link's nested hierarchy. For instance, instead of something like "Photos/People/Women/Sportswear/Candid," the category might be called "Ppwscan." I came up with a neat little recursive routine to expand each code into its Links' equivalent. Total time for all of this: About a day.)

Vann