asimlqt / php-google-spreadsheet-client

A PHP library for accessing and manipulating Google Spreadsheets
Other
544 stars 152 forks source link

how to create new spreadsheet??? #165

Open kaushikandani opened 8 years ago

kaushikandani commented 8 years ago

I want to create new sheet...

Please give me related solution.

Thanks,

qazd commented 8 years ago

You would need already existing spreadsheet table on google drive. To create it automatically, you can use drive api.

$spreadsheet = 'MySpreadsheet.xlsx'; // name of your spreadsheet file
$sheet = 'MyList'; // name of new sheet.

$rows = 1000;
$columns = 5;

$service = new Google\Spreadsheet\SpreadsheetService();

$newSheet = $service->getSpreadsheets()
            ->getByTitle($spreadsheet)
            ->addWorksheet($sheet, $rows, $columns);

$newSheet; // - instance of newly created sheet