0

I am new for accessing Google sheets with Java and get "Quick Start" work (https://developers.google.com/sheets/api/quickstart/java), but it needs manual permission for the first run. Is there any sample java codes to get it work with Service Account? thanks

Rubén
  • 34,714
  • 9
  • 70
  • 166
Harry
  • 1

1 Answers1

-1

If the position of authorization window is always the same, you can use Java robot.

import java.awt.AWTException;
import java.awt.Robot;

public static void click(int x, int y) throws AWTException{
    Robot bot = new Robot();
    bot.mouseMove(x, y);    
    bot.mousePress(InputEvent.BUTTON1_MASK);
    bot.mouseRelease(InputEvent.BUTTON1_MASK);
}

[1] How to simulate a real mouse click using java?
[2] https://www.youtube.com/watch?v=hv3QO14DJOQ

mJace
  • 49
  • 1
  • 8