Command
Import-GoogleDriveDocument
Description
The command to import Google Drive documents to a SharePoint library.
Tips:
- To perform an incremental Google Drive migration, see Incremental update using PowerShell article.
- To set your copy options, see Copy options in PowerShell.
Index
Examples
Import documents from My Drive
$connection = Connect-GoogleDrive -Email user@mycompany.com
$myDrive = Get-GoogleMyDrive -Connection $connection
$dstSite = Connect-Site -Url http://myfarm1/sites/mydestinationsite
$dstList = Get-List -Name mydstlib -Site $dstSite
Import-GoogleDriveDocument -Drive $myDrive -SourceFolder MyFolder/DocumentsToImport -DestinationList $dstList -SourceView MyDocuments
Import user's My Drive documents as admin
$connection = Connect-GoogleDrive -Email admin@mycompany.com -Admin
$myDrive = Get-GoogleMyDrive -Connection $connection -Email "user@company.com"
$dstSite = Connect-Site -Url http://myfarm1/sites/mydestinationsite
$dstList = Get-List -Name mydstlib -Site $dstSite
Import-GoogleDriveDocument -Drive $myDrive -SourceFolder MyFolder/DocumentsToImport -DestinationList $dstList -SourceView MyDocuments
Import documents from shared drive
$connection = Connect-GoogleDrive -Email user@mycompany.com
$sharedDrive = Get-GoogleSharedDrive -Connection $connection -Name "SharedDrive"
$dstSite = Connect-Site -Url http://myfarm1/sites/mydestinationsite
$dstList = Get-List -Name mydstlib -Site $dstSite
Import-GoogleDriveDocument -Drive $sharedDrive -SourceFolder MyFolder/DocumentsToImport -DestinationList $dstList -SourceView MyDocuments
Import shared drive as a folder
$connection = Connect-GoogleDrive -Email user@mycompany.com
$sharedDrive = Get-GoogleSharedDrive -Connection $connection -Name "SharedDrive"
$dstSite = Connect-Site -Url http://myfarm1/sites/mydestinationsite
$dstList = Get-List -Name mydstlib -Site $dstSite
Import-GoogleDriveDocument -Drive $sharedDrive -CopyDriveAsFolder -DestinationList $dstList -SourceView MyDocuments
Import files from Excel file
$connection = Connect-GoogleDrive -Email admin@mycompany.com -Admin
$dstSite = Connect-Site -Url http://myfarm1/sites/mydestinationsite
$dstList = Get-List -Name mydstlib -Site $dstSite
Import-GoogleDriveDocument -SourceConnection $connection -DestinationList $dstList -ExcelFilePath "path_to_file.xlsx"
Note: Use this example to copy your documents based on an Excel spreadsheet.
Specify files to copy to a given destination folder
$connection = Connect-GoogleDrive -Email user@mycompany.com
$myDrive = Get-GoogleMyDrive -Connection $connection
$dstSite = Connect-Site -Url http://myfarm1/sites/mydestinationsite
$dstList = Get-List -Name mydstlib -Site $dstSite
Import-GoogleDriveDocument -Drive $myDrive -DestinationList $dstList -SourceFilePath "MyFolder/DocumentsToImport/Document1.docx","MyFolder/DocumentsToImport/Document2.docx" -DestinationFolder "MyDestinationFolder" -SourceView MyDocuments
Specify files to copy as admin
$connection = Connect-GoogleDrive -Email admin@mycompany.com -Admin
$myDrive = Get-GoogleMyDrive -Connection $connection -Email "user@company.com"
$dstSite = Connect-Site -Url http://myfarm1/sites/mydestinationsite
$dstList = Get-List -Name mydstlib -Site $dstSite
Import-GoogleDriveDocument -Drive $myDrive -DestinationList $dstList -SourceFilePath "MyFolder/DocumentsToImport/Document1.docx","MyFolder/DocumentsToImport/Document2.docx" -SourceView MyDocuments
Import documents precheck
$connection = Connect-GoogleDrive -Email user@mycompany.com
$myDrive = Get-GoogleMyDrive -Connection $connection
$dstSite = Connect-Site -Url http://myfarm1/sites/mydestinationsite
$dstList = Get-List -Name mydstlib -Site $dstSite
Import-GoogleDriveDocument -Drive $myDrive -DestinationList $dstList -SourceView MyDocuments -WhatIf
Syntax
Import-GoogleDriveDocument
-Drive <GoogleDrive[]>
-DestinationList <List>
-SourceView <GoogleDriveView {MyDocuments | SharedWithMe | AllDocuments | SharedFromExternal}>
[-TemplateName <String>]
[-Template <PropertyTemplate>]
[-SourceFolder <Uri>]
[-SourceFilePath <Uri[]>]
[-DestinationFolder <Uri>]
[-CopySettings <CopySettings>]
[-NormalMode <SwitchParameter>]
[-WaitForImportCompletion <SwitchParameter>]
[-MappingSettings <MappingSettings>]
[-WhatIf <SwitchParameter>]
[-TaskName <String>]
Import-GoogleDriveDocument
-Drive <GoogleDrive[]>
-DestinationList <List>
-SourceView <GoogleDriveView {MyDocuments | SharedWithMe | AllDocuments | SharedFromExternal}>
-CopyDriveAsFolder <SwitchParameter>
[-TemplateName <String>]
[-Template <PropertyTemplate>]
[-DestinationFolder <Uri>]
[-CopySettings <CopySettings>]
[-NormalMode <SwitchParameter>]
[-WaitForImportCompletion <SwitchParameter>]
[-MappingSettings <MappingSettings>]
[-WhatIf <SwitchParameter>]
[-TaskName <String>]
Import-GoogleDriveDocument
-SourceConnection <GoogleDriveConnection>
-DestinationList <List>
-ExcelFilePath <String>
[-TemplateName <String>]
[-Template <PropertyTemplate>]
[-DestinationFolder <Uri>]
[-CopySettings <CopySettings>]
[-NormalMode <SwitchParameter>]
[-WaitForImportCompletion <SwitchParameter>]
[-MappingSettings <MappingSettings>]
[-WhatIf <SwitchParameter>]
[-TaskName <String>]
Parameters
-CopyDriveAsFolder <SwitchParameter>
Specifies to copy the specified drives as folders in the destination SharePoint library.
Required? | True |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | ParameterSetCopyDriveAsFolder |
Aliases | None |
-CopySettings <CopySettings>
Specifies the copy settings.
Required? | False |
Default value | None |
Accept pipeline input? | True (ByValue, ByPropertyName) |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-DestinationFolder <Uri>
Specifies the folder path at the destination. Note: This parameter cannot be used to create new folders at the destination.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-DestinationList <List>
Specifies the destination list.
Required? | True |
Default value | None |
Accept pipeline input? | True (ByValue, ByPropertyName) |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-Drive <GoogleDrive[]>
Specifies the source drive.
Required? | True |
Default value | None |
Accept pipeline input? | True (ByValue, ByPropertyName) |
Accept wildcard characters? | False |
Parameter set name | Default, ParameterSetCopyDriveAsFolder |
Aliases | None |
-ExcelFilePath <String>
Specifies the path of the file used for metadata. Supported formats are Excel and CSV.
Required? | True |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | ParameterSetExcelFilePath |
Aliases | None |
-MappingSettings <MappingSettings>
Specifies the mapping settings.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-NormalMode <SwitchParameter>
Specifies that the normal mode should be used.
Note: Insane mode is always used by default in PowerShell.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-SourceConnection <GoogleDriveConnection>
Specifies the source Google Drive connection.
Required? | True |
Default value | None |
Accept pipeline input? | True (ByValue, ByPropertyName) |
Accept wildcard characters? | False |
Parameter set name | ParameterSetExcelFilePath |
Aliases | GoogleDrive |
-SourceFilePath <Uri[]>
Specifies the source file path.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | Default |
Aliases | None |
-SourceFolder <Uri>
Specifies the folder path at the source.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | Default |
Aliases | None |
-SourceView <GoogleDriveView>
Specifies the source view, using the title.
Required? | True |
Default value | MyDocuments |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | Default, ParameterSetCopyDriveAsFolder |
Aliases | None |
-TaskName <String>
Specifies a name for the task.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-Template <PropertyTemplate>
Specifies the property template. To use the built-in "Full Copy" template, do not specify this parameter.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-TemplateName <String>
Specifies the property template to use by its name. You can use Sharegate to configure property templates for the specified list (see Import Property Mapping or New Property Template). To use the built-in "Full Copy" template, do not specify this parameter.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-WaitForImportCompletion <SwitchParameter>
Specifies that the command will wait for azure insane mode import to be completed.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-WhatIf <SwitchParameter>
Specifies that a pre-check will be executed instead of a migration. For more information, see Run a Pre-Check in PowerShell.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |