Please refer our spark dataproc template which has spanner to gcs template available. You can either use it directly or modify as per your requirements.