jagreygoose icon

Google Books Library XML Output to CSV

jagreygoose | PRO | 06/16/14 09:46:27 PM UTC | 0 ⭐ | 356 👁️ | Never ⏰ | []
PowerShell |

660 B

|

None

|

0 👍

/

0 👎

# Output Google Books Library XML Files to CSV 
# For creating labels for new library books
# $UID is the primary key for the library system, make sure you select a free range
# the script auto increments $UID from the selected starting point for each book 
 
[xml]$books = Get-Content D:\AR_Middle_years.xml 
 
 $UID = 9000
 
 $bookObj = $books.library.books.book | ForEach-Object {
      New-Object PSCustomObject -Property @{
        "ISBN" = $_.identifier.value
        "Title" = $_.title
        "Author" = $_.contributor
        "ID" = $UID++
      }
 } 
 
 $bookObj | Select Title, Author, ISBN, ID | Export-Csv -NoTypeInformation -Path D:\Books.csv

Comments