Anaplan Connect - Script Import Files
Hello
I used the following script provided by the Anaplan Connect guide to import files:
set AnaplanUser="useremail:password"set ServiceUrl="https://api.anaplan.com"
set AuthUrl="https://auth.anaplan.com"
set WorkspaceId="8a81b09e5f88df6e015f9773e37c675f"
set ModelId="FCDBA62F401B40E9B73A42983C4FDDCC"
set Operation=-debug -service %ServiceUrl% -auth %AuthUrl% -workspace %WorkspaceId% -model %ModelId% -workspaces -models -chunksize 1 -file "Ventes SR du mois.csv" -put "c:\automation\data\Ventes SR du mois.csv" -import "SR03 - Vente V&B from Ventes SR du mois.csv" -execute -output "c:\automation\data\dump\Ventes SR du mois_dump.csv"
rem *** End of settings - Do not edit below this line ***
setlocal enableextensions enabledelayedexpansion || exit /b 1
cd %~dp0
if not %AnaplanUser% == "" set Credentials=-user %AnaplanUser%
set Command="C:\automation\anaplan-connect\anaplan_connect_4.2.1\AnaplanClient.bat %Credentials% %Operation%"
@echo %Command%
cmd /c %Command%
I executed this script, i got no message of error, it tells me that the file has been uploaded.
When i return on Anaplan, the date of the import action didn't update, it's like the action didn't go through
Thank you for your attention
Regards
Best Answer
-
Hi @DanielLim2,
For me, it looks like everything works until "-import" command - so I suspect it's something with the import. Maybe you can try changing it's name to not include "&", as it's special character in Windows batch scripts language? The best practice would be also to replace "file" and "import" values with IDs of the file and import, as then you avoid problems with names completely.
Also, not sure why you have "-workspaces -modules" part there, looks like some leftover from old script, I'd suggest removing them from your script to improve the performance. So something like this should work:
set AnaplanUser="useremail:password"
set ServiceUrl="https://api.anaplan.com" set AuthUrl="https://auth.anaplan.com" set WorkspaceId="8a81b09e5f88df6e015f9773e37c675f" set ModelId="FCDBA62F401B40E9B73A42983C4FDDCC" set Operation=-debug -service %ServiceUrl% -auth %AuthUrl% -workspace %WorkspaceId% -model %ModelId% -file 113000000000 -put "c:\automation\data\Ventes SR du mois.csv" -import 112000000000 -execute -output "c:\automation\data\dump\Ventes SR du mois_dump.csv" rem *** End of settings - Do not edit below this line *** setlocal enableextensions enabledelayedexpansion || exit /b 1 cd %~dp0 if not %AnaplanUser% == "" set Credentials=-user %AnaplanUser% set Command="C:\automation\anaplan-connect\anaplan_connect_4.2.1\AnaplanClient.bat %Credentials% %Operation%" @echo %Command% cmd /c %Command%FYI: you can check the file and import ID either by:
- in Anaplan Connect script, after "-workspace" and "-model", add "imports" (or -I) to obtain the list with IDs of both import and file used for it;
- logging into Anaplan in browser and going to "https://us1a.app.anaplan.com/2/0/workspaces/{Workspace Id}/models/{Model Id}/files" and "https://us1a.app.anaplan.com/2/0/workspaces/{Workspace Id}/models/{Model Id}/imports".
0
Answers
-
Hi @M.Kierepka
I followed your instructions, and it worked.
Thank you very much for your help
Daniel
1