Batch export from Tab to CSV

1,488 views
Skip to first unread message

Ad

unread,
Nov 3, 2008, 7:29:48 AM11/3/08
to MapInfo-L
Hi,

I am hoping once more someone on here can help with my problem. :)

I wish to know if there is a way where I can export a series of
MapInfo Tab files to CSV or even .xls (excel)

Be grateful if someone could get back to me as have hundreds to do!
hehe.

As always, appreciate the help that you guys give.

Thanks,

Ad

Phil

unread,
Nov 3, 2008, 7:42:59 AM11/3/08
to MapInfo-L
Hi Ad,
Assuming you don't have access to mapbasic, you can use the mapbasic
window in Mapinfo. To do this, go to Options, show mapbasic window.

You'll then need to past something similar to the following:

Export "district" Into "C:\Data\district.txt" Type "ASCII" CharSet
"WindowsLatin1" Titles
Export "district" Into "C:\Data\district.TXT" Type "ASCII" Overwrite
Delimiter "," CharSet "WindowsLatin1" Titles

The first option is tab delimited, the 2nd comma separated.

Since you've got lots of files, you'll probably want to build up the
expressions in excel or something first and paste them all in one go.
To get a list of files in a directory go to the DOS prompt, change to
the directory and type DIR *.tab /b >files.txt. Adding /s will include
sub-directories.

Phil

Uffe Kousgaard

unread,
Nov 3, 2008, 7:43:11 AM11/3/08
to mapi...@googlegroups.com
Hi,

The export command in mapbasic allows to you to save as CSV format.

If you don't have mapbasic, you should be able to do it with a "workspace
script". Create a wor file with content similar to this:

!Workspace
!Version 400
!Charset WindowsLatin1
export table1 into "table1.csv" type "CSV"
export table2 into "table2.csv" type "CSV"
etc.

Regards
Uffe Kousgaard

Ad

unread,
Nov 3, 2008, 7:50:39 AM11/3/08
to MapInfo-L
Hi Uffe,

Thanks for quick response.

When i have created the WOR file do i just click and open in mapInfo
and the export to CSV will execute? Or do i need to do something fancy
in MapBasic within MapInfo?

Sorry my knowledge is not as vast as you guys.
> > Ad- Hide quoted text -
>
> - Show quoted text -

Uffe Kousgaard

unread,
Nov 3, 2008, 8:01:23 AM11/3/08
to mapi...@googlegroups.com
Hi,

Generally yes, but the tab files should be open in advance. Of course the
script could also include a list of open table commands, so it starts from
"scratch", like a normal workspace file.

Remember:
A workspace file is just a list of uncompiled mapbasic commands. With a
3-line header first.

Regards
Uffe

Ad

unread,
Nov 3, 2008, 8:26:11 AM11/3/08
to MapInfo-L
Hi Uffe,

That seems to work well. Only question now, is it possible to export
the column headings? The exported CSV files using method listed only
exports the data.

Many thanks

:)

Ad



On Nov 3, 1:01 pm, "Uffe Kousgaard" <u...@routeware.dk> wrote:
> Hi,
>
> > - Show quoted text -- Hide quoted text -

Uffe Kousgaard

unread,
Nov 3, 2008, 8:36:59 AM11/3/08
to mapi...@googlegroups.com
Hi,

Add the word Titles at the end of the line.

Also get the documentation for mapbasic, if you want to do more of this:
http://www.mapinfo.com/for-developers/documentation/product-documentation

Ad

unread,
Nov 3, 2008, 8:56:59 AM11/3/08
to MapInfo-L
Thanks to Uffe and Phil with your help.

Excellent,

Ad

On Nov 3, 1:36 pm, "Uffe Kousgaard" <u...@routeware.dk> wrote:
> Hi,
>
> Add the word Titles at the end of the line.
>
> Also get the documentation for mapbasic, if you want to do more of this:http://www.mapinfo.com/for-developers/documentation/product-documenta...
Reply all
Reply to author
Forward
0 new messages