04-23-2022, 02:51 PM
Being a big believer in making the computer do the heavy lifting, I just wrote this simple script to extract the bookmarks from a pdf file and reformat them into a csv file for import into mobilesheets.
The script requires pdftk, paste and sed. The latter two (paste and sed) will likely be installed by default on any Linux computer since they are standard Unix utilities. pdftk is also available for most Linux distributions but it may not be present by default so you might have to install it if it's not already there.
(If you're not sure, the command "which pdftk" will tell you if it's already installed.)
To use the script simply mark it as executable and specify the name of the pdf file on the commandline.
Example: pdfbookmarktocsv.scr myfile.pdf
That will process a pdf file named myfile.pdf and you will get a file named myfile.csv out of it.
Of course, the pdf file that you're processing must have bookmarks in it. If there are no bookmarks, then the output file will have no content.
EDIT: I should point out that the advantage of doing this rather than a straight pdf import (which is supported by mobilesheets) is that the csv file is more flexible and gives you a chance to add any fields or edits that you want before proceeding with the import.
The script requires pdftk, paste and sed. The latter two (paste and sed) will likely be installed by default on any Linux computer since they are standard Unix utilities. pdftk is also available for most Linux distributions but it may not be present by default so you might have to install it if it's not already there.
(If you're not sure, the command "which pdftk" will tell you if it's already installed.)
To use the script simply mark it as executable and specify the name of the pdf file on the commandline.
Example: pdfbookmarktocsv.scr myfile.pdf
That will process a pdf file named myfile.pdf and you will get a file named myfile.csv out of it.
Of course, the pdf file that you're processing must have bookmarks in it. If there are no bookmarks, then the output file will have no content.
EDIT: I should point out that the advantage of doing this rather than a straight pdf import (which is supported by mobilesheets) is that the csv file is more flexible and gives you a chance to add any fields or edits that you want before proceeding with the import.